Grid<T>.generate constructor

Grid<T>.generate(
  1. int width,
  2. int height,
  3. T generator(
    1. int x,
    2. int y
    )
)

Creates a new grid with the given width and height.

The grid is filled with the result of calling generator for each cell.

The width and height must be non-negative.

Implementation

factory Grid.generate(
  int width,
  int height,
  T Function(int x, int y) generator,
) = ListGrid<T>.generate;