Grid<E>.from constructor
- Grid<
E> other, { - E? empty,
Creates a new ListGrid from an existing grid.
The newer grid is a shallow copy of the existing grid, with the same size,
position, and elements. The empty
element is used as the default value,
which defaults to other.empty
if omitted.
Example
final grid = Grid.filled(2, 2, empty: 0);
grid.set(Pos(0, 0), 1);
final copy = Grid.from(grid);
print(copy.get(Pos(0, 0))); // 1
Implementation
factory Grid.from(Grid<E> other, {E? empty}) = ListGrid<E>.from;