parent property

Component? get parent

Who owns this component in the component tree.

This can be null if the component hasn't been added to the component tree yet, or if it is the root of component tree.

Setting this property to null is equivalent to removeFromParent.

Implementation

Component? get parent => _parent;
set parent (Component? newParent)

Implementation

set parent(Component? newParent) {
  if (newParent == null) {
    removeFromParent();
  } else {
    addToParent(newParent);
  }
}