refreshBoard method

void refreshBoard()

Refreshes board

Implementation

void refreshBoard() {
  if (gameLogic.inCheckmate && onCheckMate != null) {
    onCheckMate!(gameLogic.turn == chessjs.WHITE
        ? ChessboardPieceColor.White
        : ChessboardPieceColor.Black);
  } else if ((gameLogic.inDraw ||
          gameLogic.inStalemate ||
          gameLogic.inThreefoldRepetition ||
          gameLogic.insufficientMaterial) &&
      onDraw != null) {
    onDraw!();
  } else if (gameLogic.inCheck && onCheck != null) {
    onCheck!(gameLogic.turn == chessjs.WHITE
        ? ChessboardPieceColor.White
        : ChessboardPieceColor.Black);
  } else {
    if (onMove != null) onMove!(gameLogic.getHistoryVerbose().last);
  }
  notifyListeners();
}