Grid<E>.filled constructor
Creates a new ListGrid with the given width
and height
.
Each element in the grid is initialized to empty
, which is also used as
the default, or Grid.empty, element. An empty element still consumes
memory, but is used to allow resizing the grid.
The width
and height
must be non-negative.
Example
final grid = Grid.generate(2, 2, (pos) => pos.x + pos.y, empty: 0);
print(grid.get(Pos(0, 0))); // 0
print(grid.get(Pos(1, 0))); // 1
Implementation
factory Grid.filled(
int width,
int height, {
required E empty,
E? fill,
}) = ListGrid<E>.filled;