absorb method Null safety

void absorb(
  1. SemanticsConfiguration child
)

Absorb the semantic information from child into this configuration.

This adds the semantic information of both configurations and saves the result in this configuration.

The RenderObject owning the child configuration must be a descendant of the RenderObject that owns this configuration.

Only configurations that have explicitChildNodes set to false can absorb other configurations and it is recommended to only absorb compatible configurations as determined by isCompatibleWith.

Implementation

void absorb(SemanticsConfiguration child) {
  assert(!explicitChildNodes);

  if (!child.hasBeenAnnotated) {
    return;
  }

  _actions.addAll(child._actions);
  _customSemanticsActions.addAll(child._customSemanticsActions);
  _actionsAsBits |= child._actionsAsBits;
  _flags |= child._flags;
  _textSelection ??= child._textSelection;
  _scrollPosition ??= child._scrollPosition;
  _scrollExtentMax ??= child._scrollExtentMax;
  _scrollExtentMin ??= child._scrollExtentMin;
  _hintOverrides ??= child._hintOverrides;
  _indexInParent ??= child.indexInParent;
  _scrollIndex ??= child._scrollIndex;
  _scrollChildCount ??= child._scrollChildCount;
  _platformViewId ??= child._platformViewId;
  _maxValueLength ??= child._maxValueLength;
  _currentValueLength ??= child._currentValueLength;

  textDirection ??= child.textDirection;
  _sortKey ??= child._sortKey;
  _attributedLabel = _concatAttributedString(
    thisAttributedString: _attributedLabel,
    thisTextDirection: textDirection,
    otherAttributedString: child._attributedLabel,
    otherTextDirection: child.textDirection,
  );
  if (_attributedValue == null || _attributedValue.string == '') {
    _attributedValue = child._attributedValue;
  }
  if (_attributedIncreasedValue == null || _attributedIncreasedValue.string == '') {
    _attributedIncreasedValue = child._attributedIncreasedValue;
  }
  if (_attributedDecreasedValue == null || _attributedDecreasedValue.string == '') {
    _attributedDecreasedValue = child._attributedDecreasedValue;
  }
  _attributedHint = _concatAttributedString(
    thisAttributedString: _attributedHint,
    thisTextDirection: textDirection,
    otherAttributedString: child._attributedHint,
    otherTextDirection: child.textDirection,
  );
  if (_tooltip == '') {
    _tooltip = child._tooltip;
  }

  _thickness = math.max(_thickness, child._thickness + child._elevation);

  _hasBeenAnnotated = _hasBeenAnnotated || child._hasBeenAnnotated;
}