SourceRange class
A source range defines a range of characters within source code.
Constructors
- SourceRange(int offset, int length)
-
Initialize a newly created source range using the given
offset
andlength
.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
ifx
is in the interval[offset, offset + length]
. -
containsExclusive(
int x) → bool -
Return
true
ifx
is in the interval(offset, offset + length)
. -
coveredBy(
SourceRange otherRange) → bool -
Return
true
if theotherRange
covers this source range. -
covers(
SourceRange otherRange) → bool -
Return
true
if this source range covers theotherRange
. -
endsIn(
SourceRange otherRange) → bool -
Return
true
if this source range ends inside theotherRange
. -
getExpanded(
int delta) → SourceRange -
Return a source range covering
delta
characters before the start of this source range anddelta
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 theotherRange
. -
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 theotherRange
. -
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 length0
).