Range class

A range with a start and end index.

Constructors

Range(int start, int end)
Create a range.
const
Range.collapsed(int index)
Create a range with the same start and end point.
const

Properties

end int
End of the range.
final
hashCode int
The hash code for this object.
no setterinherited
isCollapsed bool
True if start == end;
no setter
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
Get the size of this range. Equal to end - start.
no setter
start int
Start of the range.
final
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

contains(Range other) bool
True if this range fully contains other (non-strictly).
copyWith({int? start, int? end}) Range
Copy this range with the given fields replaced replaced with the new values.
merge(Range other) Range
Combine a touching range with this one and return the result.
misses(Range other) bool
True if this range does not touch or overlap other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overlaps(Range other) bool
True of this range overlaps with other.
splice(Range removedSegment) Range?
Get the result after deleting a range from this range.
toString() String
A string representation of this object.
inherited
touches(Range other) bool
True if this range touches other, i.e. it either overlaps or one of its endpoints is equal to an endpoint of other.
withEnd(int end) Range
Create a range with the start from this range and the given end.
withStart(int start) Range
Create a range with the given start and the end from this range.

Operators

operator ==(Object other) bool
The equality operator.
inherited