squareColor method

String? squareColor(
  1. dynamic square
)

Returns the color of the square ('light' or 'dark'), or null if square is invalid

Implementation

String? squareColor(square) {
  if (SQUARES.containsKey(square)) {
    var sq_0x88 = SQUARES[square];
    return ((rank(sq_0x88) + file(sq_0x88)) % 2 == 0) ? 'light' : 'dark';
  }

  return null;
}