compareBy<T> function
Creates a comparator using the function to transform value to a Comparable instance for comparison.
Implementation
Comparator<T> compareBy<T>(Comparable Function(T) selector) {
int compareTo(T a, T b) => selector(a).compareTo(selector(b));
return compareTo;
}