sort<T> function Null safety

Iterable<T> sort<T>(
  1. Iterable<T> list,
  2. Comparator<T> comparator
)

Implementation

Iterable<T> sort<T>(Iterable<T> list, Comparator<T> comparator) {
  final copy = [...list];
  copy.sort(comparator);
  return copy;
}