detach method

void detach ()

Remove this scope from its parent child list.

This method is safe to call even if this scope does not have a parent.

A widget that sets a scope as the first focus of another scope should call this method during State.dispose to avoid leaving dangling children in their parent scope.

Implementation

void detach() {
  _didChangeFocusChain();
  _parent?._remove(this);
  assert(_parent == null);
}