updateSquare method

dynamic updateSquare(
  1. String squareName
)

update state of a specific square provided its squareName and the state from the logic.

Implementation

updateSquare(String squareName) {
  final newState = _logic.get(squareName);
  final index = _chessboard.squares
      .indexWhere((element) => element.value.squareName == squareName);
  _chessboard.squares[index].setSquareState(newState: newState);
}