drawImageRect method Null safety

void drawImageRect (
  1. Image image,
  2. Rect src,
  3. Rect dst,
  4. Paint paint
)

Draws the subset of the given image described by the src argument into the canvas in the axis-aligned rectangle given by the dst argument.

This might sample from outside the src rect by up to half the width of an applied filter.

Multiple calls to this method with different arguments (from the same image) can be batched into a single call to drawAtlas to improve performance.

Implementation

void drawImageRect(Image image, Rect src, Rect dst, Paint paint) {
  // ignore: unnecessary_null_comparison
  assert(image != null); // image is checked on the engine side
  assert(_rectIsValid(src));
  assert(_rectIsValid(dst));
  assert(paint != null); // ignore: unnecessary_null_comparison
  _drawImageRect(image,
                 src.left,
                 src.top,
                 src.right,
                 src.bottom,
                 dst.left,
                 dst.top,
                 dst.right,
                 dst.bottom,
                 paint._objects,
                 paint._data);
}