attach method
Joins the pipeline of o, with everything inside it: the owner lays
out and paints what is marked in it. A relayout boundary marked while
detached is laid out on the next frame, and the intrinsic sizes
worked out before are forgotten, since o measures text with its own
segmenter. The parent attaches what it adopts (adopt), and the
owner its root (PipelineOwner.root).
Implementation
void attach(PipelineOwner o) {
if (_checkedBeforePaint && !identical(owner, o)) {
owner?._checkedBeforePaint.remove(this);
o._checkedBeforePaint.add(this);
}
owner = o;
// text is measured with the new owner's segmenter
_intrinsicsCached = 0;
// a boundary marked while detached reached no owner: an ancestor laid
// out with the same constraints wouldn't lay it out
if (_needsLayout && _relayoutBoundary) {
o._addLayoutRoot(this);
}
// the owner handed down in a static, not in a closure, which makes a
// closure and a context at each object
final outer = _attaching;
_attaching = o;
try {
visitChildren(_attachChild);
} finally {
_attaching = outer;
}
}