1. protected
  2. mustCallSuper
void adoptChild(@checked AbstractNode child)

Mark the given node as being a child of this node.

Subclasses should call this function when they acquire a new child.

Source

@protected
@mustCallSuper
void adoptChild(@checked AbstractNode child) {
  assert(child != null);
  assert(child._parent == null);
  assert(() {
    AbstractNode node = this;
    while (node.parent != null)
      node = node.parent;
    assert(node != child); // indicates we are about to create a cycle
    return true;
  });
  child._parent = this;
  if (attached)
    child.attach(_owner);
  redepthChild(child);
}