renderObjectAttachingChild property

  1. @protected
Element? renderObjectAttachingChild

Returns the child of this Element that will insert a RenderObject into an ancestor of this Element to construct the render tree.

Returns null if this Element doesn't have any children who need to attach a RenderObject to an ancestor of this Element. A RenderObjectElement will therefore return null because its children insert their RenderObjects into the RenderObjectElement itself and not into an ancestor of the RenderObjectElement.

Furthermore, this may return null for Elements that hoist their own independent render tree and do not extend the ancestor render tree.

Implementation

@protected
Element? get renderObjectAttachingChild {
  Element? next;
  visitChildren((Element child) {
    assert(next == null);  // This verifies that there's only one child.
    next = child;
  });
  return next;
}