sorted method

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

returns new sorted iterable.

Implementation

Iterable<T> sorted([int Function(T, T)? f]) {
  final clone = [...this]..sort(f);
  return clone;
}