ListExtensions<E> extension

Various extensions on lists of arbitrary elements.

on

Methods

binarySearch(E element, int compare(E, E)) int

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

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

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

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

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

Returns the index of element in this sorted list.
elementAtOrNull(int index) → E?

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

The indexth element, or null if there is no such element.
equals(List<E> other, [Equality<E> equality = const DefaultEquality()]) bool

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

Whether other has the same elements as this list.
expandIndexed<R>(Iterable<R> expand(int index, E element)) Iterable<R>

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

Expands each element and index to a number of elements in a new iterable.
forEachIndexed(void action(int index, E element)) → void

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

Takes an action for each element.
forEachIndexedWhile(bool action(int index, E element)) → void

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

Takes an action for each element and index as long as desired.
forEachWhile(bool action(E element)) → void

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

Takes an action for each element as long as desired.
lowerBound(E element, int compare(E, E)) int

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

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

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

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

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

Returns the index where element should be in this sorted list.
mapIndexed<R>(R convert(int index, E element)) Iterable<R>

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

Maps each element and its index to a new value.
reverseRange(int start, int end) → void

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

Reverses the elements in a range of the list.
shuffleRange(int start, int end, [Random? random]) → void

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

Shuffle a range of elements.
slice(int start, [int? end]) ListSlice<E>

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

A fixed length view of a range of this list.
slices(int length) Iterable<List<E>>

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

Contiguous slices of this with the given length.
sortBy<K extends Comparable<K>>(K keyOf(E element), [int start = 0, int? end]) → void

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

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

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

Sorts elements by the compare of their keyOf property.
sortRange(int start, int end, int compare(E a, E b)) → void

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

Sort a range of elements by compare.
swap(int index1, int index2) → void

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

Swaps two elements of this list.
whereIndexed(bool test(int index, E element)) Iterable<E>

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

The elements whose value and index satisfies test.
whereNotIndexed(bool test(int index, E element)) Iterable<E>

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

The elements whose value and index do not satisfy test.