insertRenderObjectChild method Null safety

  1. @override
void insertRenderObjectChild(
  1. covariant RenderObject child,
  2. covariant Object? slot

Insert the given child into renderObject at the given slot.

The semantics of slot are determined by this element. For example, if this element has a single child, the slot should always be null. If this element has a list of children, the previous sibling element wrapped in an IndexedSlot is a convenient value for the slot.


void insertRenderObjectChild(RenderObject child, Object? slot) {
  final RenderObjectWithChildMixin<RenderObject> renderObject = this.renderObject as RenderObjectWithChildMixin<RenderObject>;
  assert(slot == null);
  renderObject.child = child;
  assert(renderObject == this.renderObject);