IterableExtension<TValue> extension

on

Properties

firstOrNull → TValue?
Returns the first element of the iterable if not empty, null otherwise.
no setter
lastOrNull → TValue?
Returns the last element of the iterable if not empty, null otherwise.
no setter
random → TValue
Returns a random element.
no setter

Methods

distinct([dynamic keySelector(TValue)?]) Iterable<TValue>
Returns a subset of this Iterable containing every element whose key is not equal to the key of any previous element.
firstOrNullWhere(bool selector(TValue)) → TValue?
Returns the first element of the iterable which matches the selector, null if none matches the selector or the iterable is empty.
groupBy<TKey>(TKey selector(TValue)) Map<TKey, List<TValue>>
Groups elements of this iterable by comparing the selector result.
mapIndexed<TResult>(TResult toElement(TValue, int)) Iterable<TResult>
Returns an Iterable containing the results of all elements processed by the toElement function.
max([dynamic selector(TValue)?]) → TValue
Finds the element with the largest value selected by the selector function.
min([dynamic selector(TValue)?]) → TValue
Finds the element with the smallest value selected by the selector function.
sequenceEquals(Iterable<TValue> other) bool
Deep equality check.
split(bool selector(TValue)) Tuple<List<TValue>, List<TValue>>
Splits the collection into two subsets.
whereIs<TCast>() Iterable<TCast>
Returns an Iterable containing all elements that are assignable to TCast while also casting those elements to that type.
zip<TOther>(Iterable<TOther> other) Iterable<Tuple<TValue?, TOther?>>
Merges every element of this Iterable with the corresponding element of other into a Tuple.