First version of retrieving a gamesession from the db

This commit is contained in:
2025-08-21 22:30:13 +02:00
parent 4901e27b90
commit 7a420e909a
28 changed files with 868 additions and 1175 deletions

View File

@@ -6,6 +6,8 @@
/// [kamikazePlayerIndex] is the index of the player who got kamikaze. If no one got
/// kamikaze, this value is null.
class Round {
final String roundId;
final String gameId;
final int roundNum;
final int caboPlayerIndex;
final int? kamikazePlayerIndex;
@@ -13,6 +15,8 @@ class Round {
final List<int> scoreUpdates;
Round({
required this.roundId,
required this.gameId,
required this.roundNum,
required this.caboPlayerIndex,
this.kamikazePlayerIndex,
@@ -29,6 +33,8 @@ class Round {
/// Converts the Round object to a JSON map.
Map<String, dynamic> toJson() => {
'roundId': roundId,
'gameId': gameId,
'roundNum': roundNum,
'caboPlayerIndex': caboPlayerIndex,
'kamikazePlayerIndex': kamikazePlayerIndex,
@@ -38,7 +44,9 @@ class Round {
/// Creates a Round object from a JSON map.
Round.fromJson(Map<String, dynamic> json)
: roundNum = json['roundNum'],
: roundId = json['roundId'],
gameId = json['gameId'],
roundNum = json['roundNum'],
caboPlayerIndex = json['caboPlayerIndex'],
kamikazePlayerIndex = json['kamikazePlayerIndex'],
scores = List<int>.from(json['scores']),