sortBy<R> method
Sorts the list based on the comparable returned by by
. By default
the sorting is ascending
Implementation
void sortBy<R>(Comparable<R>? by(T item), {bool ascending = true}) {
sort((a, b) {
final byA = by(a);
final byB = by(b);
if (byA == null) return ascending ? -1 : 1;
if (byB == null) return ascending ? 1 : -1;
return _compareValues(byA, byB, ascending);
});
}