compareTo method Null safety

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

Compares two locations.

other must have the same source URL as this.

Implementation

@override
int compareTo(SourceLocation other) {
  if (sourceUrl != other.sourceUrl) {
    throw ArgumentError('Source URLs "$sourceUrl" and '
        "\"${other.sourceUrl}\" don't match.");
  }
  return offset - other.offset;
}