SourceSpanBase constructor Null safety
- SourceLocation start,
- SourceLocation end,
- String text
Implementation
SourceSpanBase(this.start, this.end, this.text) {
if (end.sourceUrl != start.sourceUrl) {
throw ArgumentError('Source URLs "${start.sourceUrl}" and '
" \"${end.sourceUrl}\" don't match.");
} else if (end.offset < start.offset) {
throw ArgumentError('End $end must come after start $start.');
} else if (text.length != start.distance(end)) {
throw ArgumentError('Text "$text" must be ${start.distance(end)} '
'characters long.');
}
}