on<T> static method
Returns a Comparator that compares objects of type T by mapping them to Comparables.
Implementation
static Comparator<T> on<T>(Comparable<Object?> Function(T t) mapper) {
return (a, b) => mapper(a).compareTo(mapper(b));
}