From f9fac719b0da671ffeefb3b6a24a10d20aad4be9 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Thu, 3 Jul 2025 11:58:25 +0200 Subject: [PATCH] Changed function and altered return type --- lib/data/game_manager.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/data/game_manager.dart b/lib/data/game_manager.dart index f00d73c..f29270c 100644 --- a/lib/data/game_manager.dart +++ b/lib/data/game_manager.dart @@ -40,8 +40,12 @@ class GameManager extends ChangeNotifier { /// Removes a game session by its ID. /// Takes a String [id] as input. It finds the index of the game session with the matching ID /// in the `gameList`, and then calls `removeGameSessionByIndex` with that index. - int getGameSessionIndexById(String id) { - return gameList.indexWhere((session) => session.id.toString() == id); + bool removeGameSessionById(String id) { + final int index = + gameList.indexWhere((session) => session.id.toString() == id); + if (index == -1) return false; + removeGameSessionByIndex(index); + return true; } }