GameState class

The complete, serializable snapshot of a Tetris game.

Constructors

GameState({required BoardState board, Tetromino? activePiece, Tetromino? ghostPiece, Tetromino? heldPiece, bool canHold = true, required List<TetrominoType> nextQueue, required ScoreState scoreState, required LevelState levelState, TetrisGameStatus status = TetrisGameStatus.idle})
const
GameState.fromJson(Map<String, dynamic> json)
factory

Properties

activePiece Tetromino?
final
board BoardState
final
canHold bool
final
ghostPiece Tetromino?
final
hashCode int
The hash code for this object.
no setterinherited
heldPiece Tetromino?
final
levelState LevelState
final
nextQueue List<TetrominoType>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scoreState ScoreState
final
status TetrisGameStatus
final

Methods

copyWith({BoardState? board, Tetromino? activePiece, Tetromino? ghostPiece, Tetromino? heldPiece, bool? canHold, List<TetrominoType>? nextQueue, ScoreState? scoreState, LevelState? levelState, TetrisGameStatus? status, bool clearActive = false, bool clearGhost = false, bool clearHeld = false}) GameState
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

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