SourceLocation constructor Null safety
Creates a new location indicating offset within sourceUrl
.
line
and column
default to assuming the source is a single line. This
means that line
defaults to 0 and column
defaults to offset.
Implementation
SourceLocation(this.offset, {sourceUrl, int? line, int? column})
: sourceUrl =
sourceUrl is String ? Uri.parse(sourceUrl) : sourceUrl as Uri?,
line = line ?? 0,
column = column ?? offset {
if (offset < 0) {
throw RangeError('Offset may not be negative, was $offset.');
} else if (line != null && line < 0) {
throw RangeError('Line may not be negative, was $line.');
} else if (column != null && column < 0) {
throw RangeError('Column may not be negative, was $column.');
}
}