SplayTreeGrid<E>.filled constructor

SplayTreeGrid<E>.filled(
  1. int width,
  2. int height, {
  3. required E empty,
})

Creates a new splay tree grid 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 does not consume memory and is ideally the most common element in the grid.

The width and height must be positive.

Example

final grid = SplayTreeGrid.filled(2, 2, empty: 0);

print(grid.width); // 2
print(grid.height); // 2

print(grid.get(Pos(0, 0))); // 0

Implementation

factory SplayTreeGrid.filled(int width, int height, {required E empty}) {
  checkPositive(width, 'width');
  checkPositive(height, 'height');
  return _SplayTreeGrid(width, height, empty);
}