copy method Null safety

Chess copy()

Deep copy of the current Chess instance

Implementation

Chess copy() {
  return new Chess()
    ..board = List<Piece>.from(this.board)
    ..kings = ColorMap<int>.clone(this.kings)
    ..turn = this.turn
    ..castling = ColorMap<int>.clone(this.castling)
    ..epSquare = this.epSquare
    ..halfMoves = this.halfMoves
    ..moveNumber = this.moveNumber
    ..history = List<State>.from(this.history)
    ..header = Map.from(this.header);
}