ListExtensions<T> extension

on

Methods

all(bool test(T element)) bool

Available on List<T>, provided by the ListExtensions extension

Checks if all elements satisfy a given condition
any(bool test(T element)) bool

Available on List<T>, provided by the ListExtensions extension

Checks if at least one element satisfies a given condition
combinations(int n) List<List<T>>

Available on List<T>, provided by the ListExtensions extension

Returns a list of all combinations of size n
distinct() List<T>

Available on List<T>, provided by the ListExtensions extension

Returns a list with duplicate elements removed
firstWhereOrNull(bool test(T element)) → T?

Available on List<T>, provided by the ListExtensions extension

Finds the first element that satisfies the given condition, or null if none found
groupBy<K>(K keyExtractor(T element)) Map<K, List<T>>

Available on List<T>, provided by the ListExtensions extension

Groups elements by a specific key and returns a map of key to list of elements
lastWhereOrNull(bool test(T element)) → T?

Available on List<T>, provided by the ListExtensions extension

Finds the last element that satisfies the given condition, or null if none found
maxBy<K extends Comparable>(K keyExtractor(T element)) → T?

Available on List<T>, provided by the ListExtensions extension

Returns the maximum element based on a specific key
minBy<K extends Comparable>(K keyExtractor(T element)) → T?

Available on List<T>, provided by the ListExtensions extension

Returns the minimum element based on a specific key
reversedCopy() List<T>

Available on List<T>, provided by the ListExtensions extension

Returns a reversed copy of the list
sortBy<K extends Comparable>(K keyExtractor(T element), {bool descending = false}) → void

Available on List<T>, provided by the ListExtensions extension

Sorts the list by a specific key extracted from each element
sortedBy<K extends Comparable>(K keyExtractor(T element), {bool descending = false}) List<T>

Available on List<T>, provided by the ListExtensions extension

Returns a sorted copy of the list by a specific key extracted from each element