ChessboardModel constructor

ChessboardModel({
  1. bool enableMoves = true,
  2. bool whiteTowardUser = true,
  3. PlayerMode playerMode = PlayerMode.any,
  4. List<SquareNotifier>? board,
})

Implementation

ChessboardModel({
  this.enableMoves = true,
  this.whiteTowardUser = true,
  this.playerMode = PlayerMode.any,
  List<SquareNotifier>? board,
}) {
  /// Initialize square names for the chessboard
  /// The state of the square would be set by the controller
  if (board != null) {
    this.squares = board;
  } else {
    final temp = <SquareNotifier>[];
    for (final square in squareList.expand((element) => element)) {
      temp.add(SquareNotifier(SquareModel(squareName: square)));
    }
    squares = temp;
  }
}