Grid<T>.from2d constructor

Grid<T>.from2d({
  1. required int cellSize,
  2. required List<List<T>> data,
})

Implementation

Grid.from2d({required this.cellSize, required List<List<T>> data})
    : assert(
          data.isNotEmpty && data[0].isNotEmpty, "2d data array must contain at least 1 element"),
      width = data[0].length,
      height = data.length,
      _data = data.expand((e) => e).toList();