updateSlotForChild method

  1. @protected
void updateSlotForChild(
  1. Element child,
  2. Object? newSlot
)

Change the slot that the given child occupies in its parent.

Called by MultiChildRenderObjectElement, and other RenderObjectElement subclasses that have multiple children, when child moves from one position to another in this element's child list.

Implementation

@protected
void updateSlotForChild(Element child, Object? newSlot) {
  assert(_lifecycleState == _ElementLifecycle.active);
  assert(child._parent == this);
  void visit(Element element) {
    element.updateSlot(newSlot);
    final Element? descendant = element.renderObjectAttachingChild;
    if (descendant != null) {
      visit(descendant);
    }
  }
  visit(child);
}