SourceSpanBase constructor Null safety

SourceSpanBase(
  1. SourceLocation start,
  2. SourceLocation end,
  3. 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.');
  }
}