ListExtensions<E> extension Null safety

Various extensions on lists of arbitrary elements.

on

Methods

binarySearch(E element, int compare(E, E)) int
Returns the index of element in this sorted list. [...]
binarySearchBy<K extends Comparable<K>>(E element, K keyOf(E element), [int start = 0, int? end]) int
Returns the index of element in this sorted list. [...]
binarySearchByCompare<K>(E element, K keyOf(E element), int compare(K, K), [int start = 0, int? end]) int
Returns the index of element in this sorted list. [...]
equals(List<E> other, [Equality<E> equality = const DefaultEquality()]) bool
Whether other has the same elements as this list. [...]
expandIndexed<R>(Iterable<R> expand(int index, E element)) Iterable<R>
Expands each element and index to a number of elements in a new iterable. [...]
forEachIndexed(void action(int index, E element)) → void
Takes an action for each element. [...]
forEachIndexedWhile(bool action(int index, E element)) → void
Takes an action for each element and index as long as desired. [...]
forEachWhile(bool action(E element)) → void
Takes an action for each element as long as desired. [...]
lowerBound(E element, int compare(E, E)) int
Returns the index where element should be in this sorted list. [...]
lowerBoundBy<K extends Comparable<K>>(E element, K keyOf(E), [int start = 0, int? end]) int
Returns the index where element should be in this sorted list. [...]
lowerBoundByCompare<K>(E element, K keyOf(E), int compare(K, K), [int start = 0, int? end]) int
Returns the index where element should be in this sorted list. [...]
mapIndexed<R>(R convert(int index, E element)) Iterable<R>
Maps each element and its index to a new value.
reverseRange(int start, int end) → void
Reverses the elements in a range of the list.
shuffleRange(int start, int end, [Random? random]) → void
Shuffle a range of elements.
slice(int start, [int? end]) ListSlice<E>
A fixed length view of a range of this list. [...]
sortBy<K extends Comparable<K>>(K keyOf(E element), [int start = 0, int? end]) → void
Sorts elements by the natural order of their keyOf property. [...]
sortByCompare<K>(K keyOf(E element), int compare(K a, K b), [int start = 0, int? end]) → void
Sorts elements by the compare of their keyOf property. [...]
sortRange(int start, int end, int compare(E a, E b)) → void
Sort a range of elements by compare.
swap(int index1, int index2) → void
Swaps two elements of this list.
whereIndexed(bool test(int index, E element)) Iterable<E>
The elements whose value and index satisfies test.
whereNotIndexed(bool test(int index, E element)) Iterable<E>
The elements whose value and index do not satisfy test.