forgetChild method
Remove the given child from the element's child list, in preparation for the child being reused elsewhere in the element tree.
This updates the child model such that, e.g., visitChildren does not walk that child anymore.
The element will still have a valid parent when this is called, and the child's Element.slot value will be valid in the context of that parent. After this is called, deactivateChild is called to sever the link to this object.
The update is responsible for updating or creating the new child that
will replace this child
.
Implementation
@override
void forgetChild(Element child) {
bool inflated = false;
for (final entry in _delegateChildren) {
if (entry.element == child) {
entry.unlink();
_delegateCache.remove(entry.id);
inflated = true;
break;
}
}
if (!inflated) {
assert(!_forgottenChildren.contains(child));
assert(_children!.contains(child));
_forgottenChildren.add(child);
}
super.forgetChild(child);
}