From 35cfba457da79c270e77d3b0e62bdd48c3066fe2 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sun, 20 Jul 2025 20:20:21 +0200 Subject: [PATCH] Added method getGameSessionById() --- lib/data/game_manager.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/data/game_manager.dart b/lib/data/game_manager.dart index b3a1933..3fc5e54 100644 --- a/lib/data/game_manager.dart +++ b/lib/data/game_manager.dart @@ -21,6 +21,10 @@ class GameManager extends ChangeNotifier { 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. /// 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.