updateWith method

void updateWith ({@required SemanticsConfiguration config, List<SemanticsNode> childrenInInversePaintOrder })

Reconfigures the properties of this object to describe the configuration provided in the config argument and the children listed in the childrenInInversePaintOrder argument.

The arguments may be null; this represents an empty configuration (all values at their defaults, no children).

No reference is kept to the SemanticsConfiguration object, but the child list is used as-is and should therefore not be changed after this call.

Implementation

void updateWith({
  @required SemanticsConfiguration config,
  List<SemanticsNode> childrenInInversePaintOrder,
}) {
  config ??= _kEmptyConfig;
  if (_isDifferentFromCurrentSemanticAnnotation(config))
    _markDirty();

  _label = config.label;
  _decreasedValue = config.decreasedValue;
  _value = config.value;
  _increasedValue = config.increasedValue;
  _hint = config.hint;
  _hintOverrides = config.hintOverrides;
  _flags = config._flags;
  _textDirection = config.textDirection;
  _sortKey = config.sortKey;
  _actions = Map<SemanticsAction, _SemanticsActionHandler>.from(config._actions);
  _customSemanticsActions = Map<CustomSemanticsAction, VoidCallback>.from(config._customSemanticsActions);
  _actionsAsBits = config._actionsAsBits;
  _textSelection = config._textSelection;
  _scrollPosition = config._scrollPosition;
  _scrollExtentMax = config._scrollExtentMax;
  _scrollExtentMin = config._scrollExtentMin;
  _mergeAllDescendantsIntoThisNode = config.isMergingSemanticsOfDescendants;
  _scrollChildCount = config.scrollChildCount;
  _scrollIndex = config.scrollIndex;
  indexInParent = config.indexInParent;
  _replaceChildren(childrenInInversePaintOrder ?? const <SemanticsNode>[]);

  assert(
    !_canPerformAction(SemanticsAction.increase) || (_value == '') == (_increasedValue == ''),
    'A SemanticsNode with action "increase" needs to be annotated with either both "value" and "increasedValue" or neither',
  );
  assert(
    !_canPerformAction(SemanticsAction.decrease) || (_value == '') == (_decreasedValue == ''),
    'A SemanticsNode with action "increase" needs to be annotated with either both "value" and "decreasedValue" or neither',
  );
}