CollectionsExtensions<T> extension

on

Properties

fourth → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Fourth element.
no setter
getRandom → dynamic

Available on Iterable<T>, provided by the CollectionsExtensions extension

Retrieves a random element from the current Iterable.
no setter
halfLength int

Available on Iterable<T>, provided by the CollectionsExtensions extension

Calculates and returns the half length of the current Iterable as an integer.
no setter
random → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a random element from the list.
no setter
reversed Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new iterable with the elements of this iterable in reverse order.
no setter
second → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Second element.
no setter
third → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Third element.
no setter
withoutDups List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list that contains the unique elements of the original list.
no setter

Methods

all(bool predicate(T element)) bool

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns true if all elements match the given predicate or if the collection is empty.
any(bool predicate(T element)) bool

Available on Iterable<T>, provided by the CollectionsExtensions extension

Checks if any element in the list satisfies the given predicate.
append(Iterable<T> elements) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

associate(dynamic key(dynamic element), dynamic value(dynamic element)) Map

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a new Map by associating each element in the Iterable with a key-value pair.
averageBy(num selector(T element)) double

Available on Iterable<T>, provided by the CollectionsExtensions extension

Calculates the average of the selected values from all elements in the collection.
chunked(int size) Iterable<List<T>>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable where elements are grouped into chunks of a specified size.
clearSublist([String sublistName = 'checks']) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list where the specified sublist in each entry is cleared.
containsAny(List<T> elements) bool

Available on Iterable<T>, provided by the CollectionsExtensions extension

Determines if the calling list contains any elements from the provided list.
containsMapKey(Map entity) bool

Available on Iterable<T>, provided by the CollectionsExtensions extension

Checks if any map in the list contains the specified entity key.
count([bool predicate(T element)?]) int

Available on Iterable<T>, provided by the CollectionsExtensions extension

Counts the number of elements in the current Iterable that satisfy the given predicate.
cycle([int n = 0]) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates an iterable that cycles through the elements of this iterable.
distinct() Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable containing only distinct elements.
distinctBy(dynamic predicate(T selector)) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a new List containing distinct elements based on the result of the given predicate.
drop(int n) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a list containing all elements except first n elements.
elementAtOrDefault(int index, T defaultValue) → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns an element at the given index or defaultValue if the index is out of bounds of this collection.
elementAtOrElse(int index, T defaultValue(int index)) → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this collection.
except(Iterable<T> elements) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Yields elements from this iterable that are not present in the elements iterable.
exceptElement(T element) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Yields elements from this iterable that are not equal to the specified element.
fillSublist(T newValue, [String sublistName = 'checks']) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list where all elements of the specified sublist are replaced with a given value.
filter(bool test(T element)) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a new List containing only the elements that satisfy the given test function.
filterIndexed(bool predicate(T element, int index)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns all elements that satisfy the given predicate.
filterIndexedTo(List<T> destination, bool predicate(T element, int index)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements matching the given predicate to the given destination.
filterNotIndexed(bool predicate(T element, int index)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns all elements not matching the given predicate.
filterNotNull() Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable with all elements which are not null.
filterNotTo(List<T> destination, bool predicate(T element)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements not matching the given predicate to the given destination.
filterNotToIndexed(List<T> destination, bool predicate(T element, int index)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements not matching the given predicate to the given destination.
filterTo(List<T> destination, bool predicate(T element)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements matching the given predicate to the given destination.
find(dynamic predicate(T selector)) → T?

Available on Iterable<T>, provided by the CollectionsExtensions extension

Finds the first element in the Iterable that satisfies the given predicate.
firstHalf() List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Takes the first half of a list
firstWhereOrNull(bool test(T)) → T?

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the first element that satisfies the given test function, or null if no element matches.
firstWhile(bool predicate(T element)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Yields elements from the iterable as long as the predicate condition is met.
flatMap<R>(Iterable<R> transform(T element)) Iterable<R>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable containing elements yielded from the results of the transform function being invoked on each element of this collection.
flatten() Iterable

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable where all elements of nested Iterables are flattened.
getRandomValueByFieldName(String fieldname) String

Available on Iterable<T>, provided by the CollectionsExtensions extension

Retrieves a random value from an element in the current Iterable based on the specified fieldname.
groupBy<T, String>(String mapper(T e), {Iterable order = const [], Iterable pinned = const []}) Map<String, List<T>>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Groups the elements of the current Iterable by a key derived from each element.
joinToString({String separator = ', ', String transform(T element)?, String prefix = '', String postfix = '', int limit = 0, String truncated = '...'}) String

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a string from all the elements separated using separator and using the given prefix and postfix if supplied.
keyInList(int index) bool

Available on Iterable<T>, provided by the CollectionsExtensions extension

Checks if the index is within the bounds of the iterable.
lastOrNullWhere(bool predicate(T element)) → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the last element matching the given predicate, or null if no such element was found.
lastWhile(bool predicate(T element)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Yields elements from the end of the iterable as long as the predicate condition is met.
mapIndexed<R>(R transform(int index, T)) Iterable<R>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable containing only the non-null results of applying the given transform function to each element in the original collection. Returns a new lazy Iterable containing the results of applying the given transform function to each element of this collection, where the function takes two arguments: the index of the current element and the element itself.
mapIndexedNotNull<R>(R transform(int index, T)) Iterable<R>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable containing the results of applying the given transform function to each element of this collection, where the function takes two arguments: the index of the current element and the element itself, and filters out the elements for which the transform function returns null.
mapList<T>(T f(dynamic doc)) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Applies the provided function f to each element in the current Iterable and returns a new List containing the transformed elements.
mapNotNull<R>(R transform(T element)) Iterable<R>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable containing the non-null results of applying the given transform function to each element of this collection.
mapToOptions<T>(String key, String title) Map<String, Map>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Maps the current iterable to a Map where each key represents a unique date and the corresponding value is a List of elements assigned on that date.
max() → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the largest element or null if there are no elements.
maxBy(Comparable selector(T element)) → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the first element yielding the largest value of the given selector or null if there are no elements.
maxWith(Comparator<T> comparator) → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the first element having the largest value according to the provided comparator or null if there are no elements.
min() → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the smallest element or null if there are no elements.
minBy(Comparable selector(T element)) → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the first element yielding the smallest value of the given selector or null if there are no elements.
minWith(Comparator<T> comparator) → T

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns the first element having the smallest value according to the provided comparator or null if there are no elements.
none(bool predicate(T element)) bool

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns true if no entries match the given predicate or if the collection is empty.
onEach(void action(T element)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Invokes the specified action for each element in the iterable and returns a new lazy iterable that yields the same elements.
onlyOwned<T>(String uid) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list containing only the elements that are owned by the specified uid.
requireNoNulls() → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns an original collection containing all the non-null elements, throwing an StateError if there are any null elements.
secondHalf() List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Takes the second half of a list
shuffled(Random random) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new List containing all elements of this iterable in a random order.
slice(int start, [int end = -1]) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a slice of a list from start up to, but not including, end.
sorted() List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list containing all elements sorted in ascending order.
sortedByTime(Comparable key(T e), {bool reversed = false}) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

sortedByTimeOnly(DateTime key(T e), {bool reversed = false}) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list sorted based on the time extracted from the given key function. The key function should return a DateTime value from which the time is extracted (ignoring the date).
sortedByValue(Comparable key(T e), {bool reversed = false}) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list sorted based on the values derived from the given key function.
subtract(Iterable<T> other) → dynamic

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a new Set that contains all the elements of the current Set except for the elements that are also present in the other Iterable.
sumBy(num selector(T element)) double

Available on Iterable<T>, provided by the CollectionsExtensions extension

Calculates the sum of the selected values from all elements in the collection.
sumByValue(num selector(T)) double

Available on Iterable<T>, provided by the CollectionsExtensions extension

Calculates the sum of a list of objects based on a specific property value.
swap(int i, int j) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a new List with the elements at positions i and j swapped.
takeFirst(int n) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list containing the first n elements from this iterable.
takeLast(int n) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list containing the last n elements from this iterable.
toHashSet() HashSet<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates a new HashSet containing all the elements of this iterable.
toIterable() Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable containing all elements of this collection.
toMutableSet() Set<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Converts the current Set to a mutable Set.
toUnmodifiable() List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Creates an unmodifiable List containing all the elements of this iterable.
union(Iterable<T> other) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable that represents the union of this iterable and the other iterable.
whereIndexed(bool predicate(T element, int index)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns all elements that satisfy the given predicate.
whereIndexedTo(List<T> destination, bool predicate(T element, int index)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements that satisfy the given predicate (which includes the element's index) to the destination list.
whereNot(bool predicate(T element)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Yields all elements of the iterable for which the predicate returns false.
whereNotIndexed(bool predicate(T element, int index)) Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Yields all elements of the iterable for which the predicate (including the element's index) returns false.
whereNotNull() Iterable<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable containing all elements of this collection that are not null.
whereNotTo(List<T> destination, bool predicate(T element)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements not matching the given predicate to the given destination.
whereNotToIndexed(List<T> destination, bool predicate(T element, int index)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements not matching the given predicate (which includes the element's index) to the given destination.
whereTo(List<T> destination, bool predicate(T element)) → void

Available on Iterable<T>, provided by the CollectionsExtensions extension

Appends all elements that satisfy the given predicate to the destination list.

Operators

operator +(Iterable<T> elements) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new lazy Iterable that appends the given elements iterable to this iterable.
operator -(Iterable<T> elements) List<T>

Available on Iterable<T>, provided by the CollectionsExtensions extension

Returns a new list of elements from this iterable with the elements from elements excluded.