sortedBy method

List<T> sortedBy(
  1. Comparator<T> compare, {
  2. bool growable = true,
})

Returns a new list with all elements sorted according to the order specified by the compare function.

Implementation

List<T> sortedBy(Comparator<T> compare, {bool growable = true}) {
  final list = toList(growable: growable);
  list.sort(compare);
  return list;
}