Updates global list for storing games
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
import 'package:cabo_counter/data/game_session.dart';
|
import 'package:cabo_counter/data/game_session.dart';
|
||||||
|
|
||||||
class Globals {
|
class Globals {
|
||||||
static Map<int, GameSession> gamesMap = <int, GameSession>{};
|
/// The [gameList] contains all active game sessions.
|
||||||
|
static List<GameSession> gameList = [];
|
||||||
|
|
||||||
|
static void addGameSession(GameSession session) {
|
||||||
|
gameList.add(session);
|
||||||
|
gameList.sort((a, b) => b.createdAt.compareTo(a.createdAt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user