Matrix.fromAsciiDefinition constructor
Creates a Matrix from an ASCII representation.
template
A list of strings where '#' represents true and any other character represents false.
Implementation
factory Matrix.fromAsciiDefinition(final List<String> template) {
final Matrix matrix = Matrix();
matrix.rows = template.length;
matrix.cols = template[0].length;
matrix._data = List.generate(
matrix.rows,
(y) => List.generate(matrix.cols, (x) => template[y][x] == '#'),
);
return matrix;
}