Grid<E>.fromCells constructor

Grid<E>.fromCells(
  1. Iterable<E> elements, {
  2. required int width,
  3. E? empty,
})

Creates a new ListGrid from elements in row-major order.

Each element in rows, a column, must have the same length, and the resulting grid will have a width equal to the number of columns, and a height equal to the length of each column.

The grid is initialized with the elements in the rows, where the element at index (x, y) is rows.elementAt(y).elementAt(x). If the empty element is omitted, the most common element in the rows is used, in which case the rows must be non-empty.

Implementation

factory Grid.fromCells(
  Iterable<E> elements, {
  required int width,
  E? empty,
}) = ListGrid<E>.fromCells;