GenericGame class

Represents a generic game, with common fields that can be manipulated by common GenericEvents

Includes

Annotations
  • @freezed

Constructors

GenericGame({required DateTime time, required GameStatus status, required int round, @Default(IListConst([])) IList<Player> players, @Default(IListConst([])) IList<PlayerID> readyPlayers})
const
factory
GenericGame.fromJson(Map<String, dynamic> map)
factory
GenericGame.start(IList<Player> players)
Creates a default initialized game with players
factory
GenericGame.startRandom(IList<Player> players)
Creates a default initialized game where the first player is chosen at random
factory

Properties

copyWith → $GenericGameCopyWith<GenericGame>
no setterinherited
gameOver bool
Gets whether the game is over
no setter
hashCode int
The hash code for this object.
no setterinherited
players IList<Player>
no setterinherited
readyPlayers IList<String>
no setterinherited
round int
no setterinherited
roundOver bool
Gets whether the round is over
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status GameStatus
no setterinherited
time DateTime
no setterinherited

Methods

addReadyPlayer(PlayerID player) GenericGame
Adds a ready player to the list
clearReadyPlayers() GenericGame
Clears the list of ready players
finishRound() GenericGame
Returns a copy of the GenericGame with the round incremented, status set to GameStatus.started
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shufflePlayers() GenericGame
Shuffles the player list, and resets the currentPlayerIndex to the first
toJson() Map<String, dynamic>
inherited
toString() String
A string representation of this object.
inherited
updateStatus(GameStatus status) GenericGame
Returns a copy of the GenericGame with the status updated to status
updateTime() GenericGame
Returns a copy of the GenericGame with the time updated to the current time

Operators

operator ==(Object other) bool
The equality operator.
inherited