ChessboardModel constructor
ChessboardModel({
- bool enableMoves = true,
- bool whiteTowardUser = true,
- PlayerMode playerMode = PlayerMode.any,
- 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;
}
}