isSubtypeOf method

bool isSubtypeOf(
  1. XPathType other
)

Whether this type is equal to or a subtype of other.

Implementation

bool isSubtypeOf(XPathType other) {
  if (identical(this, other) || this == other) return true;
  if (other is XPathSequenceType) {
    return isSubtypeOf(other.itemType);
  }
  XPathType? current = this;
  while (current != null) {
    if (identical(current, other) || current == other) return true;
    current = current.parent;
  }
  return false;
}