absorb method

void absorb (SemanticsConfiguration other)

Absorb the semantic information from other into this configuration.

This adds the semantic information of both configurations and saves the result in 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 other) {
  assert(!explicitChildNodes);

  if (!other.hasBeenAnnotated)
    return;

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

  textDirection ??= other.textDirection;
  _sortKey ??= other._sortKey;
  _label = _concatStrings(
    thisString: _label,
    thisTextDirection: textDirection,
    otherString: other._label,
    otherTextDirection: other.textDirection,
  );
  if (_decreasedValue == '' || _decreasedValue == null)
    _decreasedValue = other._decreasedValue;
  if (_value == '' || _value == null)
    _value = other._value;
  if (_increasedValue == '' || _increasedValue == null)
    _increasedValue = other._increasedValue;
  _hint = _concatStrings(
    thisString: _hint,
    thisTextDirection: textDirection,
    otherString: other._hint,
    otherTextDirection: other.textDirection,
  );

  _hasBeenAnnotated = _hasBeenAnnotated || other._hasBeenAnnotated;
}