setXY method Null safety

void setXY(
  1. int x,
  2. int y,
  3. T value
)

Sets element value.

Implementation

void setXY(int x, int y, T value) {
  final tensorShape = this.tensorShape;
  if (tensorShape.numberOfDimensions != 2) {
    throw ArgumentError('Shape of the tensor is: $tensorShape');
  }
  if (x < 0 || x >= tensorShape.x) {
    throw ArgumentError.value(x, 'x');
  }
  if (y < 0 || y >= tensorShape.y) {
    throw ArgumentError.value(y, 'y');
  }
  elements[x + tensorShape.x * y] = value;
}