reshape method Null safety

List reshape(
  1. List list,
  2. List shape
)

Implementation

List reshape(List list, List shape) {
  List flat = flatten(list);
  int mult = 1;
  for (int i = 0; i < shape.length; i++) {
    mult = mult * shape[i] as int;
  }
  var temp;
  if (mult == flat.length) {
    temp = generate(flat, shape);
  } else {
    throw new Exception(
        "DartTensorException : Dart Tensor and shape are different.");
  }
  return temp;
}