attach method

  1. @mustCallSuper
void attach(
  1. PipelineOwner owner

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).


void attach(PipelineOwner owner) {
  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;
  if (_needsCompositingBitsUpdate) {
    _needsCompositingBitsUpdate = false;
  if (_needsPaint && _layerHandle.layer != null) {
    // Don't enter this block if we've never painted at all;
    // scheduleInitialPaint() will handle it
    _needsPaint = false;
  if (_needsSemanticsUpdate && _semanticsConfiguration.isSemanticBoundary) {
    // Don't enter this block if we've never updated semantics at all;
    // scheduleInitialSemantics() will handle it
    _needsSemanticsUpdate = false;