parent property

Component? 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;
void parent=(Component? newParent)

Implementation

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