sortBy method
Sorts this list by the value returned by sortKey
for each element.
This method is guaranteed to calculate sortKey
only once for each
element.
Example:
var list = [-12, 3, 10];
list.sortBy((e) => e.toString().length); // list is now [3, 10, -12].
Implementation
void sortBy(Comparable<dynamic> Function(E) sortKey) {
final sortKeyCache = <E, Comparable<dynamic>>{};
this.sort((a, b) => sortKeyCompare(a, b, sortKey, sortKeyCache));
}