moveRenderObjectChild method

  1. @override
void moveRenderObjectChild(
  1. covariant RenderObject child,
  2. covariant IndexedSlot<Element?> oldSlot,
  3. covariant IndexedSlot<Element?> newSlot
)
override

Move the given child from the given old slot to the given new slot.

The given child is guaranteed to have renderObject as its parent.

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.

This method is only ever called if updateChild can end up being called with an existing Element child and a slot that differs from the slot that element was previously given. MultiChildRenderObjectElement does this, for example. SingleChildRenderObjectElement does not (since the slot is always null). An Element that has a specific set of slots with each child always having the same slot (and where children in different slots are never compared against each other for the purposes of updating one slot with the element from another slot) would never call this.

Implementation

@override
void moveRenderObjectChild(RenderObject child, IndexedSlot<Element?> oldSlot, IndexedSlot<Element?> newSlot) {
  final ContainerRenderObjectMixin<RenderObject, ContainerParentDataMixin<RenderObject>> renderObject = this.renderObject;
  assert(child.parent == renderObject);
  renderObject.move(child, after: newSlot.value?.renderObject);
  assert(renderObject == this.renderObject);
}