getHistorySAN method Null safety

List<String> getHistorySAN()

Get current history of game in SAN format

Implementation

List<String> getHistorySAN() {
  List<Move> reversedHistory = [];
  List<String> moveHistory = [];
  while (history.length > 0) {
    reversedHistory.add(undoMove()!);
  }

  while (reversedHistory.length > 0) {
    Move move = reversedHistory.removeLast();
    moveHistory.add(moveToSan(move));
    makeMove(move);
  }

  return moveHistory;
}