Move.parse constructor
Move.parse(
- String move
Parses a move
from String.
Implementation
factory Move.parse(String move) {
if (move.isEmpty || move.length > 2) {
throw ArgumentError('Invalid move: $move');
}
final letter = move[0].toUpperCase();
final inverted = move.length > 1 && move[1] == "'";
final double = move.length > 1 && move[1] == '2';
final color = Color.of(letter);
return Move(color, inverted: inverted, double: double);
}