attach method

  1. @mustCallSuper
void attach(
  1. PipelineOwner owner
)

Mark this render object 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 attach all their children to the same owner after calling the inherited method, as in super.attach(owner).

Implementation

@mustCallSuper
void attach(PipelineOwner owner) {
  assert(!_debugDisposed);
  assert(_owner == null);
  _owner = 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();
  }
}