compareTo method Null safety

  1. @override
int compareTo(
  1. SourceSpan other
)
override

Compares two spans.

other must have the same source URL as this. This orders spans by start then length.

Implementation

@override
int compareTo(SourceSpan other) {
  final result = start.compareTo(other.start);
  return result == 0 ? end.compareTo(other.end) : result;
}