copyWith method

Board copyWith({
  1. SquareSet? occupied,
  2. SquareSet? promoted,
  3. SquareSet? white,
  4. SquareSet? black,
  5. SquareSet? pawns,
  6. SquareSet? knights,
  7. SquareSet? bishops,
  8. SquareSet? rooks,
  9. SquareSet? queens,
  10. SquareSet? kings,
})

Returns a copy of this board with some fields updated.

Implementation

Board copyWith({
  SquareSet? occupied,
  SquareSet? promoted,
  SquareSet? white,
  SquareSet? black,
  SquareSet? pawns,
  SquareSet? knights,
  SquareSet? bishops,
  SquareSet? rooks,
  SquareSet? queens,
  SquareSet? kings,
}) {
  return Board(
    occupied: occupied ?? this.occupied,
    promoted: promoted ?? this.promoted,
    white: white ?? this.white,
    black: black ?? this.black,
    pawns: pawns ?? this.pawns,
    knights: knights ?? this.knights,
    bishops: bishops ?? this.bishops,
    rooks: rooks ?? this.rooks,
    queens: queens ?? this.queens,
    kings: kings ?? this.kings,
  );
}