forEach method
Iterates over each value in the matrix. Skips over default values, which can be done very efficiently on sparse matrices.
Implementation
void forEach(void Function(int row, int col, T value) callback) {
for (var row = 0; row < rowCount; row++) {
for (var col = 0; col < colCount; col++) {
final value = getUnchecked(row, col);
if (dataType.defaultValue != value) {
callback(row, col, getUnchecked(row, col));
}
}
}
}