adoptChild method Null safety

  1. @override
void adoptChild(
  1. covariant RenderObject child

Called by subclasses when they decide a render object is a child.

Only for use by subclasses when changing their child lists. Calling this in other cases will lead to an inconsistent tree and probably cause crashes.


void adoptChild(RenderObject child) {
  final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
  if (!childParentData._keptAlive)
    childManager.didAdoptChild(child as RenderBox);