compareByDescending<T> function

Comparator<T> compareByDescending <T>(
  1. Comparable selector(
    1. T
    )
)

Creates a descending comparator using the function to transform value to a Comparable instance for comparison.

Implementation

Comparator<T> compareByDescending<T>(Comparable Function(T) selector) {
  int compareTo(T a, T b) => selector(b).compareTo(selector(a));
  return compareTo;
}