SourceCode constructor
SourceCode(})
Implementation
SourceCode(this.text,
{this.uri,
this.isCompilationUnit = true,
this.selectionStart,
this.selectionLength}) {
// Must either provide both selection bounds or neither.
if ((selectionStart == null) != (selectionLength == null)) {
throw ArgumentError(
'If selectionStart is provided, selectionLength must be too.');
}
if (selectionStart != null) {
if (selectionStart! < 0) {
throw ArgumentError('selectionStart must be non-negative.');
}
if (selectionStart! > text.length) {
throw ArgumentError('selectionStart must be within text.');
}
}
if (selectionLength != null) {
if (selectionLength! < 0) {
throw ArgumentError('selectionLength must be non-negative.');
}
if (selectionStart! + selectionLength! > text.length) {
throw ArgumentError('selectionLength must end within text.');
}
}
}