hasOverlap method

bool hasOverlap(
  1. num low,
  2. num high
)

Whether any interval overlaps [low, high]. Short-circuits on the first match, so it is cheaper than checking queryRange(...).isNotEmpty. Audited: 2026-06-12 11:26 EDT

Implementation

bool hasOverlap(num low, num high) {
  // Enforced in release (an assert strips): low > high silently returns false
  // instead of signaling an inverted query range.
  if (low > high) {
    throw ArgumentError('low ($low) must be <= high ($high)');
  }
  return _anyOverlap(_root, low, high);
}