SourceRange class

A source range defines a range of characters within source code.

Annotations
  • @AnalyzerPublicApi.new(message: 'exported by package:analyzer/source/source_range.dart')

Constructors

SourceRange(int offset, int length)
Initialize a newly created source range using the given offset and length.
const

Properties

end → int
Return the 0-based index of the character immediately after this source range.
no setter
hashCode → int
The hash code for this object.
no setteroverride
length → int
The number of characters in the source range.
final
offset → int
The 0-based index of the first character of the source range.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

contains(int x) → bool
Return true if x is in the interval [offset, offset + length].
containsExclusive(int x) → bool
Return true if x is in the interval (offset, offset + length).
coveredBy(SourceRange otherRange) → bool
Return true if the otherRange covers this source range.
covers(SourceRange otherRange) → bool
Return true if this source range covers the otherRange.
endsIn(SourceRange otherRange) → bool
Return true if this source range ends inside the otherRange.
getExpanded(int delta) → SourceRange
Return a source range covering delta characters before the start of this source range and delta characters after the end of this source range.
getMoveEnd(int delta) → SourceRange
Return a source range with the same offset as this source range but whose length is delta characters longer than this source range.
getTranslated(int delta) → SourceRange
Return a source range with the same length as this source range but whose offset is delta characters after the offset of this source range.
getUnion(SourceRange otherRange) → SourceRange
Return the minimal source range that covers both this and the otherRange.
intersects(SourceRange? otherRange) → bool
Return true if this source range intersects the otherRange.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startsIn(SourceRange otherRange) → bool
Return true if this source range starts in the otherRange.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Constants

EMPTY → const SourceRange
An empty source range (a range with offset 0 and length 0).