paintChild method Null safety

void paintChild(
  1. RenderObject child,
  2. Offset offset
)

Paint a child RenderObject.

If the child has its own composited layer, the child will be composited into the layer subtree associated with this painting context. Otherwise, the child will be painted into the current PictureLayer for this context.

Implementation

void paintChild(RenderObject child, Offset offset) {
  assert(() {
    debugOnProfilePaint?.call(child);
    return true;
  }());

  if (child.isRepaintBoundary) {
    stopRecordingIfNeeded();
    _compositeChild(child, offset);
  // If a render object was a repaint boundary but no longer is one, this
  // is where the framework managed layer is automatically disposed.
  } else if (child._wasRepaintBoundary) {
    assert(child._layerHandle.layer is OffsetLayer);
    child._layerHandle.layer = null;
    child._paintWithContext(this, offset);
  } else {
    child._paintWithContext(this, offset);
  }
}