toArray method

dynamic toArray(
  1. dynamic arrangement
)

Converts an arrangement of pieces from String to Array.

param arrangement A starting position's arrangement returns The same arrangement as an array, or false if invalid arrangement

Implementation

dynamic toArray(arrangement) {
    if (!FischerRandomValidators().isValidArrangement(arrangement)) return false;
    if (arrangement is List<String>) {
      return arrangement;
    } else {
      return arrangement.runes.map((e) => String.fromCharCode(e).toString()).toList();
    }
  }