adopt method

void adopt(
  1. RenderObject child
)

Makes child, which has no parent, a child of this object: gives it parentData (setupParentData), attaches it to this object's owner, if any, and lays this object out again. The parent's own list of children holds it too (RenderObjectWithChildMixin.child, ContainerRenderObjectMixin.insert).

Implementation

void adopt(RenderObject child) {
  setupParentData(child);
  child.parent = this;
  if (owner != null) {
    child.attach(owner!);
  }
  markNeedsLayout();
}