setPixel method Null safety

void setPixel(
  1. int x,
  2. int y,
  3. int color
)

Set the pixel at the given x, y coordinate to the color. No range checking is done.

Implementation

void setPixel(int x, int y, int color) {
  data[y * width + x] = color;
}