adoptChild method
- 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.
Implementation
@mustCallSuper
@protected
void adoptChild(RenderObject child) {
assert(child._parent == null);
assert(() {
RenderObject node = this;
while (node.parent != null) {
node = node.parent!;
}
assert(node != child); // indicates we are about to create a cycle
return true;
}());
setupParentData(child);
markNeedsLayout();
markNeedsCompositingBitsUpdate();
markNeedsSemanticsUpdate();
child._parent = this;
if (attached) {
child.attach(_owner!);
}
redepthChild(child);
}