IterableExtensions<T> extension
Common iterable extensions
- on
-
- Iterable<
T>
- Iterable<
Properties
-
unique
→ List<
T> -
Available on Iterable<
Returns a new list containing the unique elements from the original iterable.T> , provided by the IterableExtensions extensionno setter
Methods
-
averageBy(
num selector(T)) → num -
Available on Iterable<
Calculates the average value of all elements in the iterable by mapping them to numeric values.T> , provided by the IterableExtensions extension -
count(
bool test(T element)) → int -
Available on Iterable<
Counts the number of elements that satisfy theT> , provided by the IterableExtensions extensiontest. -
distinctBy(
Object? selector(T e)) → List< T> -
Available on Iterable<
Returns a list of unique elements based on a selector function.T> , provided by the IterableExtensions extension -
firstWhereOrNull(
bool test(T)) → T? -
Available on Iterable<
Tries to find the first element in the iterable that matches the givenT> , provided by the IterableExtensions extensiontest. Returns null if no such element is found. -
forEachIndexed(
void f(int index, T element)) → void -
Available on Iterable<
Iterates through the iterable with both index and element.T> , provided by the IterableExtensions extension -
groupBy<
K> (K keyFunction(T)) → Map< K, List< T> > -
Available on Iterable<
Groups the elements in the iterable according to theT> , provided by the IterableExtensions extensionkeyFunction. Returns a map where each key corresponds to a list of elements that share that key. -
mapIndexed<
E> (E f(int index, T element)) → Iterable< E> -
Available on Iterable<
Maps each element along with its index to a new value.T> , provided by the IterableExtensions extension -
mapToList<
E> (E convert(T)) → List< E> -
Available on Iterable<
Converts the iterable to a list using aT> , provided by the IterableExtensions extensionconvertfunction for each element. -
sumBy(
num selector(T)) → num -
Available on Iterable<
Calculates the sum of all elements in the iterable by mapping them to numeric values.T> , provided by the IterableExtensions extension -
whereIndexed(
bool test(int index, T element)) → Iterable< T> -
Available on Iterable<
Returns a new iterable containing elements that satisfy the test with their index.T> , provided by the IterableExtensions extension -
windowed(
int size, {int step = 1, bool partialWindows = false}) → Iterable< List< T> > -
Available on Iterable<
Returns a sliding window of a givenT> , provided by the IterableExtensions extensionsizeand optionalstep. -
zip(
Iterable other) → Iterable< List> -
Available on Iterable<
Zips this iterable with anotherT> , provided by the IterableExtensions extensionotheriterable.