distance method Null safety
- 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();
}