mount method

void mount(
  1. Element? parent
)

Adds this element to the tree as a child of parent.

Implementation

void mount(Element? parent) {
  this.parent = parent;
  if (parent != null) {
    _owner = parent.owner;
  }
  treeDepth = parent != null ? parent.treeDepth + 1 : 0;
  _mounted = true;
  final k = widget.key;
  // Skip GlobalKey registration if we are measuring intrinsics in a temporary
  // subtree. Registering here would overwrite the real active element's key
  // mapping and prematurely remove it from the registry during unmount.
  if (k is GlobalKey && Zone.current[#isMeasuringIntrinsics] != true) {
    GlobalKey.registry[k] = this;
  }
}