nthLargest<T> function
Returns the k-th largest element (0-based: k = 0 is the maximum), or
null if k is out of range. Equivalent to nthSmallest from the other
end.
Audited: 2026-06-12 11:26 EDT
Implementation
T? nthLargest<T>(Iterable<T> items, int k, Comparator<T> compare) =>
nthSmallest(items, k, (T a, T b) => compare(b, a));