getPixelSafe method Null safety

int getPixelSafe(
  1. int x,
  2. int y
)

Get the pixel from the given x, y coordinate. Color is encoded in a Uint32 as #AABBGGRR. If the pixel coordinates are out of bounds, 0 is returned.

Implementation

int getPixelSafe(int x, int y) => boundsSafe(x, y) ? data[y * width + x] : 0;