ExtensionIterableT<T> extension
- on
-
- Iterable<
T>
- Iterable<
Properties
- firstOrNull → T?
-
Available on Iterable<
Returns the first element. If there is no first element it will returnT> , provided by the ExtensionIterableT extensionnull
.no setter - lastIndex → int?
-
Available on Iterable<
Returns the last accessible index. If collection is empty this returnsT> , provided by the ExtensionIterableT extensionnull
.no setter - lastOrNull → T?
-
Available on Iterable<
Returns the last element. If there is no last element it will returnT> , provided by the ExtensionIterableT extensionnull
.no setter -
withoutFirst
→ Iterable<
T> -
Available on Iterable<
Lazily returns all values without the first one.T> , provided by the ExtensionIterableT extensionno setter -
withoutLast
→ Iterable<
T> -
Available on Iterable<
Lazily returns all values without the last one.T> , provided by the ExtensionIterableT extensionno 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 ExtensionIterableT extensiontransform
function. -
associateBy<
K> (K keySelector(T element)) → Map< K, T> -
Available on Iterable<
Returns a map where everyT> , provided by the ExtensionIterableT extensionelement
is associated by a key produced from thekeySelector
function. -
associateWith<
V> (V valueSelector(T element)) → Map< T, V> -
Available on Iterable<
Returns a map where everyT> , provided by the ExtensionIterableT extensionelement
is used as a key that is associated with a value produced by thevalueSelector
function. -
averageBy(
num selector(T)) → double? -
Available on Iterable<
Returns the average value (arithmetic mean) of all values produces by theT> , provided by the ExtensionIterableT extensionselector
function 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 ExtensionIterableT extensionsize
. -
count(
[bool test(T element)?]) → int -
Available on Iterable<
Returns the number of elements that matches theT> , provided by the ExtensionIterableT extensiontest
. -
elementAtOrElse(
int index, T orElse()) → T -
Available on Iterable<
Returns theT> , provided by the ExtensionIterableT extensionindex
th element. If the index is out of bounds theorElse
supplier function is called to provide a value. -
elementAtOrNull(
int index) → T -
Available on Iterable<
Returns theT> , provided by the ExtensionIterableT extensionindex
th element. If the index is out of bounds it will returnnull
. -
filter(
bool test(T element)) → Iterable< T> -
Available on Iterable<
Returns a new Iterable with all elements that satisfy the predicateT> , provided by the ExtensionIterableT extensiontest
. -
firstOrElse(
T orElse()) → T -
Available on Iterable<
Returns the first element. If there is no first element theT> , provided by the ExtensionIterableT extensionorElse
supplier function is called to provide a value. -
forEachIndexed(
void funcIndexValue(int index, T element)) → void -
Available on Iterable<
Applies the functionT> , provided by the ExtensionIterableT extensionfuncIndexValue
to each element of this collection in iteration order. The function receives the element index as first parameterindex
and theelement
as 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 ExtensionIterableT extensionkeySelector
function. -
insertElementBetween(
T element) → List< T> -
Available on Iterable<
insert Element Between Example:T> , provided by the ExtensionIterableT extension -
lastOrElse(
T orElse()) → T -
Available on Iterable<
Returns the last element. If there is no last element theT> , provided by the ExtensionIterableT extensionorElse
supplier function is called to provide a value. -
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 ExtensionIterableT extension -
maximumBy(
Comparator< T> comparator) → T? -
Available on Iterable<
Returns the maximum value based on theT> , provided by the ExtensionIterableT extensioncomparator
function. -
minimumBy(
Comparator< T> comparator) → T? -
Available on Iterable<
Returns the minimal value based on theT> , provided by the ExtensionIterableT extensioncomparator
function. -
onEach(
void action(T element)) → Iterable< T> -
Available on Iterable<
Applies the givenT> , provided by the ExtensionIterableT extensionaction
on 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 ExtensionIterableT extensionaction
on each element and also returns the whole Iterable without modifying it. Theaction
takes a second parameterindex
matching the element index. -
pickOne(
[Random? random]) → T -
Available on Iterable<
Returns a random item. The randomness can be customized by settingT> , provided by the ExtensionIterableT extensionrandom
. -
pickSome(
int count, [Random? random]) → List< T> -
Available on Iterable<
Returns an List ofT> , provided by the ExtensionIterableT extensioncount
random 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 ExtensionIterableT extensioncomparator
withnewValue
. -
replaceWhere(
bool comparator(T currentValue), T newValue) → Iterable< T> -
Available on Iterable<
Replaces every element that matches theT> , provided by the ExtensionIterableT extensioncomparator
withnewValue
. -
sortedBy(
Comparator< T> comparator) → List<T> -
Available on Iterable<
Returns this as sorted list using theT> , provided by the ExtensionIterableT extensioncomparator
function. -
sortedByNum(
num valueProvider(T element)) → List< T> -
Available on Iterable<
Returns this as sorted list using theT> , provided by the ExtensionIterableT extensionvalueProvider
function 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 ExtensionIterableT extensionvalueProvider
function 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 ExtensionIterableT extensionselector
function 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 ExtensionIterableT extensionselector
function that is applied to each element.