iterables library

Classes

EnumerateIterable<V>
An Iterable of IndexedValues where the nth value holds the nth element of Iterable and its index. See enumerate.
EnumerateIterator<V>
The Iterator returned by EnumerateIterable.iterator.
Extent<T>
GeneratingIterable<T>
An Iterable whose first value is the result of _initial and whose subsequent values are generated by passing the current value to the _next function.
IndexedValue<V>
InfiniteIterable<T>
A base class for Iterables of infinite length that throws UnsupportedError for methods that would require the Iterable to terminate.

Functions

concat<T>(Iterable<Iterable<T>> iterables) Iterable<T>
Returns the concatenation of the input iterables.
count([num start = 0, num step = 1]) Iterable<num>
Returns an infinite Iterable of nums, starting from start and increasing by step.
cycle<T>(Iterable<T> iterable) Iterable<T>
Returns an Iterable that infinitely cycles through the elements of iterable. If iterable is empty, the returned Iterable will also be empty.
enumerate<E>(Iterable<E> iterable) Iterable<IndexedValue<E>>
Returns an Iterable of IndexedValues where the nth value holds the nth element of iterable and its index.
extent<T>(Iterable<T> i, [Comparator<T>? compare]) Extent<T>
Returns the minimum and maximum values in i, according to the order specified by the compare function, in an Extent instance. Always returns an Extent, but Extent.min and Extent.max may be null if i is empty.
generate(dynamic initial(), dynamic next(dynamic)) Iterable
max<T>(Iterable<T> i, [Comparator<T>? compare]) → T?
Returns the maximum value in i, according to the order specified by the compare function, or null if i is empty.
merge<T>(Iterable<Iterable<T>> iterables, [Comparator<T>? compare]) Iterable<T>
Returns the result of merging an Iterable of Iterables, according to the order specified by the compare function. This function assumes the provided iterables are already sorted according to the provided compare function. It will not check for this condition or sort the iterables.
min<T>(Iterable<T> i, [Comparator<T>? compare]) → T?
Returns the minimum value in i, according to the order specified by the compare function, or null if i is empty.
partition<T>(Iterable<T> iterable, int size) Iterable<List<T>>
Partitions the input iterable into lists of the specified size.
range(num startOrStop, [num? stop, num? step]) Iterable<num>
Returns an Iterable sequence of nums.
zip<T>(Iterable<Iterable<T>> iterables) Iterable<List<T>>
Returns an Iterable of Lists where the nth element in the returned iterable contains the nth element from every Iterable in iterables. The returned Iterable is as long as the shortest Iterable in the argument. If iterables is empty, it returns an empty list.