copySorted method

List<T> copySorted([
  1. int compare(
    1. T a,
    2. T b
    )?
])

Returns a sorted copy of the iterable

Implementation

List<T> copySorted([int Function(T a, T b)? compare]) {
  final list = List<T>.from(this);
  list.sort(compare);
  return list;
}