Updated gameSession class
This commit is contained in:
@@ -13,7 +13,7 @@ import 'package:uuid/uuid.dart';
|
|||||||
/// [isGameFinished] is a boolean indicating if the game has ended yet.
|
/// [isGameFinished] is a boolean indicating if the game has ended yet.
|
||||||
/// [winner] is the name of the player who won the game.
|
/// [winner] is the name of the player who won the game.
|
||||||
class GameSession extends ChangeNotifier {
|
class GameSession extends ChangeNotifier {
|
||||||
late String id;
|
final String id;
|
||||||
final DateTime createdAt;
|
final DateTime createdAt;
|
||||||
final String gameTitle;
|
final String gameTitle;
|
||||||
final List<String> players;
|
final List<String> players;
|
||||||
@@ -27,6 +27,7 @@ class GameSession extends ChangeNotifier {
|
|||||||
List<Round> roundList = [];
|
List<Round> roundList = [];
|
||||||
|
|
||||||
GameSession({
|
GameSession({
|
||||||
|
required this.id,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
required this.gameTitle,
|
required this.gameTitle,
|
||||||
required this.players,
|
required this.players,
|
||||||
@@ -35,8 +36,6 @@ class GameSession extends ChangeNotifier {
|
|||||||
required this.isPointsLimitEnabled,
|
required this.isPointsLimitEnabled,
|
||||||
}) {
|
}) {
|
||||||
playerScores = List.filled(players.length, 0);
|
playerScores = List.filled(players.length, 0);
|
||||||
var uuid = const Uuid();
|
|
||||||
id = uuid.v1();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ void main() {
|
|||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
session = GameSession(
|
session = GameSession(
|
||||||
|
id: '1',
|
||||||
createdAt: testDate,
|
createdAt: testDate,
|
||||||
gameTitle: testTitle,
|
gameTitle: testTitle,
|
||||||
players: testPlayers,
|
players: testPlayers,
|
||||||
|
|||||||
Reference in New Issue
Block a user