1. override
void detach()

Mark this node as detached.

Typically called only from the parent's detach, and by the owner to mark the root of a tree as detached.

Subclasses with children should detach all their children whenever this method is called.

Source

@override
void detach() {
  assert(owner._nodes.containsKey(id));
  assert(!owner._detachedNodes.contains(this));
  owner._nodes.remove(id);
  owner._detachedNodes.add(this);
  super.detach();
  if (_children != null) {
    for (SemanticsNode child in _children) {
      // The list of children may be stale and may contain nodes that have
      // been assigned to a different parent.
      if (child.parent == this)
        child.detach();
    }
  }
}