clipRectAndPaint method Null safety

void clipRectAndPaint(
  1. Rect rect,
  2. Clip clipBehavior,
  3. Rect bounds,
  4. VoidCallback painter
)

Clip canvas with Path according to rect and then paint. canvas is restored to the pre-clip status afterwards.

bounds is the saveLayer bounds used for Clip.antiAliasWithSaveLayer.

Implementation

void clipRectAndPaint(Rect rect, Clip clipBehavior, Rect bounds, VoidCallback painter) {
  _clipAndPaint((bool doAntiAlias) => canvas.clipRect(rect, doAntiAlias: doAntiAlias), clipBehavior, bounds, painter);
}