attach method Null safety
- covariant PipelineOwner owner
override
Mark this node as attached to the given owner.
Typically called only from the parent's attach method, and by the
owner
to mark the root of a tree as attached.
Subclasses with children should override this method to first call their
inherited attach method, and then attach all their children to the
same owner
.
Implementations of this method should start with a call to the inherited
method, as in super.attach(owner)
.
Implementation
@override
void attach(PipelineOwner owner) {
assert(!_debugDisposed);
super.attach(owner);
// If the node was dirtied in some way while unattached, make sure to add
// it to the appropriate dirty list now that an owner is available
if (_needsLayout && _relayoutBoundary != null) {
// Don't enter this block if we've never laid out at all;
// scheduleInitialLayout() will handle it
_needsLayout = false;
markNeedsLayout();
}
if (_needsCompositingBitsUpdate) {
_needsCompositingBitsUpdate = false;
markNeedsCompositingBitsUpdate();
}
if (_needsPaint && _layerHandle.layer != null) {
// Don't enter this block if we've never painted at all;
// scheduleInitialPaint() will handle it
_needsPaint = false;
markNeedsPaint();
}
if (_needsSemanticsUpdate && _semanticsConfiguration.isSemanticBoundary) {
// Don't enter this block if we've never updated semantics at all;
// scheduleInitialSemantics() will handle it
_needsSemanticsUpdate = false;
markNeedsSemanticsUpdate();
}
}