distance method

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

Returns the distance in characters between this and other.

This always returns a non-negative value.

Implementation

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