Sorting data topic

Sort and reorder lists of values.

Functions

ascending(Object? a, Object? b) num Sorting data
Returns -1 if a is less than b, or 1 if a is greater than b, or 0.
descending(Object? a, Object? b) num Sorting data
Returns -1 if a is greater than b, or 1 if a is less than b, or 0.
permute<T>(Iterable<T> iterable, Iterable<int> keys) List<T?> Sorting data
Returns a permutation of the specified iterable using the keys.
permuteMap<K, V>(Map<K, V> map, Iterable<K> keys) List<V?> Sorting data
Returns a permutation of the specified map using the keys.
quickselect<T extends List<E>, E>(T elements, num k, {num left = 0, num right = double.infinity, int compare(E, E) = ascendingDefined}) → T Sorting data
See mourner/quickselect.
reverse<T>(Iterable<T> iterable) List<T> Sorting data
Returns an list containing the values in the given iterable in reverse order.
shuffle<T>(List<T> list, [int start = 0, int? stop]) List<T> Sorting data
Randomizes the order of the specified list in-place using the Fisher–Yates shuffle and returns the list.
shuffler<T>(num random()) List<T> Function(List<T>, [int, int?]) Sorting data
Returns a shuffle function given the specified random source. For example, using randomLcg:
sort<T>(Iterable<T> iterable, [num comparator(T, T) = ascending]) List<T> Sorting data
Returns an list containing the values in the given iterable in the sorted order defined by the given comparator.
sortBy<T, R>(Iterable<T> iterable, R accessor(T), [num comparator(R, R) = ascending]) List<T> Sorting data
Returns a list containing the elements of the given iterable in the sorted order defined by the values yielded by the given accessor function.