resize method Null safety

void resize(
  1. Model15<ProgramOperation> m,
  2. int rows,
  3. int columns
)

Implementation

void resize(Model15 m, int rows, int columns) {
  if (rows < 0 || columns < 0) {
    throw ArgumentError('rows $rows columns $columns');
  } else if (rows == this.rows && columns == this.columns) {
    return;
  }
  int totalMatrix = rows * columns - 2 * length;
  for (final mat in m.matrices) {
    totalMatrix += mat.length;
  }
  if (totalMatrix > 64) {
    // bottom of page 148
    throw CalculatorError(10);
  }
  m.memory.policy.checkAvailable(rows * columns - length);
  isLU = false;
  final values = List<Value>.filled(rows * columns, Value.zero);
  for (int i = 0; i < values.length && i < _values.length; i++) {
    values[i] = _values[i];
  }
  _columns = (rows == 0) ? 0 : columns;
  _values = values;
  m.needsSave = true;
}