Cube.from constructor

Cube.from(
  1. String definition
)

Creates a Cube from the your definition string U..R..F..D..L..B.

Implementation

factory Cube.from(String definition) {
  if (definition.length != 54) {
    throw ArgumentError('Invalid definition');
  }

  return Cube.of([
    for (var i = 0; i < definition.length; i++) Color.of(definition[i]),
  ]);
}