insertChild method
Inserts a child for the specified node.
Implementation
void insertChild(RenderBox child, TKey nodeId) {
// Defensive drop of any prior box at this slot. Normal lifecycle pairs
// removeRenderObjectChild before insertRenderObjectChild, but a path
// that skips remove (forgetChild + reparent, an exception between
// remove/insert) would leave the old box adopted — causing adoptChild
// to assert "child already has a parent" or the old box to become a
// zombie still walked by attach/detach.
final existing = _children[nodeId];
if (existing != null && !identical(existing, child)) {
dropChild(existing);
}
_children[nodeId] = child;
adoptChild(child);
(child.parentData! as SliverTreeParentData).nodeId = nodeId;
}