copyWith method
GameState
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,
Implementation
GameState 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(
board: board ?? this.board,
activePiece: clearActive ? null : activePiece ?? this.activePiece,
ghostPiece: clearGhost ? null : ghostPiece ?? this.ghostPiece,
heldPiece: clearHeld ? null : heldPiece ?? this.heldPiece,
canHold: canHold ?? this.canHold,
nextQueue: nextQueue ?? this.nextQueue,
scoreState: scoreState ?? this.scoreState,
levelState: levelState ?? this.levelState,
status: status ?? this.status,
);