resetSingleton function

void resetSingleton(
  1. bool reversedBoard
)

Function that resets the information of the BoardData singleton.

It should be used after ending a game in order to clear all the data.

Implementation

void resetSingleton(bool reversedBoard) {
  BoardData board = BoardData();
  board.currentBoard = _initTablero(reversedBoard);
  board.boardMovements = initEmptyMovements();
  board.squares = [];
  board.clocks = [];
  board.whiteTurn = true;
  board.reversedBoard = reversedBoard;
  board.selectedSquare = [-1, -1];
  board.lastMovement = [
    [-1, -1],
    [-1, -1]
  ];
  board.prom = "";
  board.nextMoveIsCheckmate = false;
  board.spectatorMode = false;
}