Matrix constructor

Matrix([
  1. num width = 0,
  2. num height = 0,
  3. bool value = false
])

Creates a new Matrix with the specified dimensions, filled with the given value.

width The number of columns in the matrix. height The number of rows in the matrix. value The initial value for all cells (default is false).

Implementation

Matrix([
  final num width = 0,
  final num height = 0,
  final bool value = false,
]) {
  _data = List.generate(
    height.toInt(),
    (_) => List.filled(width.toInt(), false),
  );
  cols = width.toInt();
  rows = height.toInt();
}