isCompatibleWith method

bool isCompatibleWith(
  1. SemanticsConfiguration? other
)

Whether this configuration is compatible with the provided other configuration.

Two configurations are said to be compatible if they can be added to the same SemanticsNode without losing any semantics information.

Implementation

bool isCompatibleWith(SemanticsConfiguration? other) {
  if (other == null || !other.hasBeenAnnotated) {
    return true;
  }
  // The parent node should reject child node as long as their
  // traversalChildIdentifiers are different, even if the parent node has not
  // been annotated.
  if (_traversalChildIdentifier != other._traversalChildIdentifier) {
    return false;
  }
  if (!hasBeenAnnotated) {
    return true;
  }
  if (_actionsAsBits & other._actionsAsBits != 0) {
    return false;
  }
  if (_flags.hasConflictingFlags(other._flags)) {
    return false;
  }

  if (_platformViewId != null && other._platformViewId != null) {
    return false;
  }
  if (_maxValueLength != null && other._maxValueLength != null) {
    return false;
  }
  if (_currentValueLength != null && other._currentValueLength != null) {
    return false;
  }
  if (_attributedValue.string.isNotEmpty && other._attributedValue.string.isNotEmpty) {
    return false;
  }
  if (_localeForSubtree != other._localeForSubtree) {
    return false;
  }
  if (_hasExplicitRole && other._hasExplicitRole) {
    return false;
  }
  if (_hitTestBehavior != ui.SemanticsHitTestBehavior.defer ||
      other._hitTestBehavior != ui.SemanticsHitTestBehavior.defer) {
    return false;
  }
  if (_minValue != null && other._minValue != null) {
    return false;
  }
  if (_maxValue != null && other._maxValue != null) {
    return false;
  }
  return true;
}