IterableBasics2<T> extension
- on
-
- Iterable<
T>
- Iterable<
Properties
- lastIndex → int?
-
Available on Iterable<
Returns the last accessible index. If collection is empty this returnsT> , provided by the IterableBasics2 extensionnull.no setter
Methods
-
associate<
K, V> (MapEntry< K, V> transform(T element)) → Map<K, V> -
Available on Iterable<
Returns a map that contains MapEntrys provided by aT> , provided by the IterableBasics2 extensiontransformfunction. -
associateBy<
K> (K keySelector(T element)) → Map< K, T> -
Available on Iterable<
Returns a map where everyT> , provided by the IterableBasics2 extensionelementis associated by a key produced from thekeySelectorfunction. -
associateWith<
V> (V valueSelector(T element)) → Map< T, V> -
Available on Iterable<
Returns a map where everyT> , provided by the IterableBasics2 extensionelementis used as a key that is associated with a value produced by thevalueSelectorfunction. -
averageBy(
num selector(T)) → double? -
Available on Iterable<
Returns the average value (arithmetic mean) of all values produces by theT> , provided by the IterableBasics2 extensionselectorfunction that is applied to each element. -
chunked(
int size, {T fill()?}) → Iterable< List< T> > -
Available on Iterable<
Splits the elements into lists of the specifiedT> , provided by the IterableBasics2 extensionsize. -
count(
[bool test(T element)?]) → int -
Available on Iterable<
Returns the number of elements that matches theT> , provided by the IterableBasics2 extensiontest. -
elementAtOrElse(
int index, T orElse()) → T -
Available on Iterable<
Returns theT> , provided by the IterableBasics2 extensionindexth element. If the index is out of bounds theorElsesupplier function is called to provide a value. -
filter(
bool test(T element)) → Iterable< T> -
Available on Iterable<
Returns a new Iterable with all elements that satisfy the predicateT> , provided by the IterableBasics2 extensiontest. -
firstOrElse(
T orElse()) → T -
Available on Iterable<
Returns the first element. If there is no first element theT> , provided by the IterableBasics2 extensionorElsesupplier function is called to provide a value. -
firstOrNull(
) → T -
Available on Iterable<
Returns the first element. If there is no first element it will returnT> , provided by the IterableBasics2 extensionnull. -
forEachIndexed(
void funcIndexValue(int index, T element)) → void -
Available on Iterable<
Applies the functionT> , provided by the IterableBasics2 extensionfuncIndexValueto each element of this collection in iteration order. The function receives the element index as first parameterindexand theelementas the second parameter. -
groupBy<
K, V> (K keySelector(T element), {V valueTransform(T element)?}) → Map< K, List< V> > -
Available on Iterable<
Groups the elements of the list into a map by a key that is defined by aT> , provided by the IterableBasics2 extensionkeySelectorfunction. -
lastOrElse(
T orElse()) → T -
Available on Iterable<
Returns the last element. If there is no last element theT> , provided by the IterableBasics2 extensionorElsesupplier function is called to provide a value. -
lastOrNull(
) → T -
Available on Iterable<
Returns the last element. If there is no last element it will returnT> , provided by the IterableBasics2 extensionnull. -
mapIndexed<
U> (U transformer(T currentValue, int index)) → Iterable< U> -
Available on Iterable<
Just like map, but with access to the element's current index.T> , provided by the IterableBasics2 extension -
maximumBy(
Comparator< T> comparator) → T? -
Available on Iterable<
Returns the maximum value based on theT> , provided by the IterableBasics2 extensioncomparatorfunction. -
minimumBy(
Comparator< T> comparator) → T? -
Available on Iterable<
Returns the minimal value based on theT> , provided by the IterableBasics2 extensioncomparatorfunction. -
onEach(
void action(T element)) → Iterable< T> -
Available on Iterable<
Applies the givenT> , provided by the IterableBasics2 extensionactionon each element and also returns the whole Iterable without modifying it. -
onEachIndexed(
void action(T element, int index)) → Iterable< T> -
Available on Iterable<
Applies the givenT> , provided by the IterableBasics2 extensionactionon each element and also returns the whole Iterable without modifying it. Theactiontakes a second parameterindexmatching the element index. -
pickOne(
[Random? random]) → T -
Available on Iterable<
Returns a random item. The randomness can be customized by settingT> , provided by the IterableBasics2 extensionrandom. -
pickSome(
int count, [Random? random]) → List< T> -
Available on Iterable<
Returns an List ofT> , provided by the IterableBasics2 extensioncountrandom items. The randomness can be customized by settingrandom. -
replaceFirstWhere(
bool comparator(T currentValue), T newValue) → Iterable< T> -
Available on Iterable<
Replaces the first element that matches theT> , provided by the IterableBasics2 extensioncomparatorwithnewValue. -
replaceWhere(
bool comparator(T currentValue), T newValue) → Iterable< T> -
Available on Iterable<
Replaces every element that matches theT> , provided by the IterableBasics2 extensioncomparatorwithnewValue. -
sortedBy(
Comparator< T> comparator) → List<T> -
Available on Iterable<
Returns this as sorted list using theT> , provided by the IterableBasics2 extensioncomparatorfunction. -
sortedByNum(
num valueProvider(T element)) → List< T> -
Available on Iterable<
Returns this as sorted list using theT> , provided by the IterableBasics2 extensionvalueProviderfunction that produces numerical values as base for sorting. -
sortedByString(
String valueProvider(T element)) → List< T> -
Available on Iterable<
Returns this as sorted list using theT> , provided by the IterableBasics2 extensionvalueProviderfunction that produces character values as base for sorting. -
sumBy(
int selector(T)) → int -
Available on Iterable<
Returns the sum of all values produced by theT> , provided by the IterableBasics2 extensionselectorfunction that is applied to each element. -
sumByDouble(
num selector(T)) → double -
Available on Iterable<
Returns the sum of all values produced by theT> , provided by the IterableBasics2 extensionselectorfunction that is applied to each element. -
withoutFirst(
) → Iterable< T> -
Available on Iterable<
Lazily returns all values without the first one.T> , provided by the IterableBasics2 extension -
withoutLast(
) → Iterable< T> -
Available on Iterable<
Lazily returns all values without the last one.T> , provided by the IterableBasics2 extension