Added method getGameSessionById()

This commit is contained in:
2025-07-20 20:20:21 +02:00
parent 03ed2a22d5
commit 35cfba457d

View File

@@ -21,6 +21,10 @@ class GameManager extends ChangeNotifier {
return gameList.indexOf(session); return gameList.indexOf(session);
} }
GameSession? getGameSessionById(String id) {
return gameList.firstWhere((session) => session.id.toString() == id);
}
/// Removes a game session from the list and sorts it by creation date. /// Removes a game session from the list and sorts it by creation date.
/// Takes a [index] as input. It then removes the session at the specified index from the `gameList`, /// Takes a [index] as input. It then removes the session at the specified index from the `gameList`,
/// sorts the list in descending order based on the creation date, and notifies listeners of the change. /// sorts the list in descending order based on the creation date, and notifies listeners of the change.