copyWith method

GameState copyWith({
  1. LevelConfig? level,
  2. int? levelIndex,
  3. List<Cell>? grid,
  4. GameStatus? status,
  5. int? timeLeft,
  6. int? selectedIndex,
  7. int? score,
  8. int? addRowsUsed,
})

Implementation

GameState copyWith({
  LevelConfig? level,
  int? levelIndex,
  List<Cell>? grid,
  GameStatus? status,
  int? timeLeft,
  int? selectedIndex,
  int? score,
  int? addRowsUsed,
}) {
  return GameState(
    level: level ?? this.level,
    levelIndex: levelIndex ?? this.levelIndex,
    grid: grid ?? this.grid,
    status: status ?? this.status,
    timeLeft: timeLeft ?? this.timeLeft,
    selectedIndex: selectedIndex,
    score: score ?? this.score,
    addRowsUsed: addRowsUsed ?? this.addRowsUsed,
  );
}