getXY method Null safety

T getXY(
  1. int x,
  2. int y
)

Gets matrix element.

Implementation

T getXY(int x, int y) {
  if (x >= width) {
    throw ArgumentError.value(x, 'x');
  }
  if (y >= height) {
    throw ArgumentError.value(y, 'y');
  }
  return elements[y * width + x];
}