sorted method

Iterable<T> sorted([
  1. int compare(
    1. T,
    2. T
    )?
])

Implementation

Iterable<T> sorted([int Function(T, T)? compare]) {
  final copy = toList();

  copy.sort(compare);

  return copy;
}