insertRenderObjectChild method Null safety

  1. @protected
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(covariant RenderObject child, covariant Object? slot) {
  assert(() {
    throw FlutterError.fromParts(<DiagnosticsNode>[
      ErrorSummary('RenderObjectElement.insertChildRenderObject() is deprecated.'),
        name: 'insertChildRenderObject() was called on this Element',
        style: DiagnosticsTreeStyle.shallow,
        'insertChildRenderObject() has been deprecated in favor of '
        'insertRenderObjectChild(). See '
        'for details.',
        'Rather than overriding insertChildRenderObject() in your '
        'RenderObjectElement subclass, override insertRenderObjectChild() instead, '
        "and DON'T call super.insertRenderObjectChild(). If you're implementing a "
        'new RenderObjectElement, you should override/implement '
        'insertRenderObjectChild(), moveRenderObjectChild(), and '