Changed function and altered return type

This commit is contained in:
2025-07-03 11:58:25 +02:00
parent f784240411
commit f9fac719b0

View File

@@ -40,8 +40,12 @@ class GameManager extends ChangeNotifier {
/// Removes a game session by its ID. /// 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 /// 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. /// in the `gameList`, and then calls `removeGameSessionByIndex` with that index.
int getGameSessionIndexById(String id) { bool removeGameSessionById(String id) {
return gameList.indexWhere((session) => session.id.toString() == id); final int index =
gameList.indexWhere((session) => session.id.toString() == id);
if (index == -1) return false;
removeGameSessionByIndex(index);
return true;
} }
} }