sortedByCompare<K> method
- K keyOf(
- T element
- Comparator<
K> compare
Creates a sorted list of the elements of the iterable.
The elements are ordered by the compare
Comparator of the
property keyOf
of the element.
Implementation
List<T> sortedByCompare<K>(
K Function(T element) keyOf, Comparator<K> compare) {
var elements = [...this];
mergeSortBy<T, K>(elements, keyOf, compare);
return elements;
}