forward method

PlayedMove? forward()

Moves one move forward in the _gameHistory.

Returns the next move from future moves if successful, otherwise null.

Implementation

PlayedMove? forward() {
  if (!canGoForward) return null;

  final PlayedMove nextMove = _gameHistory.forward();
  if (_board.safeMove(nextMove) != null) return nextMove;

  _gameHistory.backward();
  return null;
}