IntRange class
Represents a range of integers.
This class allows defining a range with a start and end value, and whether the start and end are inclusive or exclusive.
Constructors
Properties
- endInclusive → bool
-
no setterinherited
- first → int
-
The first element.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
int> -
Returns an iterator over the elements in this range.
Throws an exception if the range is not discrete or is infinite.
no setteroverride
- last → int
-
The last element.
no setterinherited
- length → int
-
The number of elements in this Iterable.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → int
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
- startInclusive → bool
-
no setterinherited
Methods
-
any(
bool test(int element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
compareTo(
Range< Comparable> other) → int -
Compares this range to another range. First compare starts of the ranges. If start
of this range is less than the start of the other, return -1, if it's greater, return 1.
If both starts are equal, compare ends of the ranges.
inherited
-
contains(
Object? obj) → bool -
Detect whether this range contains an element.
inherited
-
elementAt(
int index) → int -
Returns the
index
th element.inherited -
end(
{bool? inclusive}) → num? -
If
inclusive
is provided and differs from the current end inclusion, the end value is adjusted to the next or previous value accordingly.inherited -
every(
bool test(int element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
except(
Range< num> that) → List<Range< num> > -
The difference between two ranges is the set of all elements that are in this range but not in the other range.
inherited
-
expand<
T> (Iterable< T> toElements(int element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(int element), {int orElse()?}) → int -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, int element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< int> other) → Iterable<int> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(int element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
intersect(
Range< num> that) → Range<num> ? -
The intersection of two ranges is the set of all elements that are in both ranges.
inherited
-
isAdjacentTo(
Range< num> that) → bool -
Test whether this range is adjacent to another range. The ranges are adjacent
if the end of this range is the same as the start of the other range or vice versa.
inherited
-
isSubsetOf(
Range< num> that, {bool strict = false}) → bool -
Evaluate whether this range is a subset of another.
inherited
-
isSupersetOf(
Range< num> that, {bool strict = false}) → bool -
Evaluate whether this range is a superset of another.
inherited
-
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(int element), {int orElse()?}) → int -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T toElement(int e)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
newInstance(
) → IntRange -
Creates a new empty instance of the range.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overlaps(
Range< num> that) → bool -
Check whether this range overlaps with another range.
inherited
-
reduce(
int combine(int value, int element)) → int -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
singleWhere(
bool test(int element), {int orElse()?}) → int -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< int> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(int value)) → Iterable< int> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
start(
{bool? inclusive}) → num? -
If
inclusive
is provided and differs from the current start inclusion, the start value is adjusted to the next or previous value accordingly.inherited -
take(
int count) → Iterable< int> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(int value)) → Iterable< int> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toList(
{bool growable = true}) → List< int> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< int> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
union(
Range< num> that) → List<Range< num> > -
The union of two ranges is the set of all elements that are in either range.
inherited
-
where(
bool test(int element)) → Iterable< int> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator *(
Range< num> that) → Range<num> ? -
Operator for the intersection of this range and another range.
inherited
-
operator +(
Range< num> that) → List<Range< num> > -
Operator for the union of this range and another range.
inherited
-
operator -(
Range< num> that) → List<Range< num> > -
Operator for the difference between this range and another range.
inherited
-
operator ==(
Object that) → bool -
Ranges are equal if they have same start and end dates and inclusions.
inherited
Static Properties
- regexInfInf ↔ RegExp
-
Regular expression for a range from negative to positive infinity.
getter/setter pair
- regexInfVal ↔ RegExp
-
Regular expression for a range from negative infinity to a int.
getter/setter pair
- regexValInf ↔ RegExp
-
Regular expression for a range from a int to positive infinity.
getter/setter pair
- regexValVal ↔ RegExp
-
Regular expression for a range between two ints.
getter/setter pair