top method

List<T> top(
  1. int n
)

Returns the n largest elements in descending order.

Implementation

List<T> top(int n) {
  _checkNonNegativeCount(n);
  return (toList()..sort()).reversed.take(n).toList();
}