sortedBy method Null safety

List<T> sortedBy(
  1. [Comparator<T>? compare]
)

Implementation

List<T> sortedBy([Comparator<T>? compare]) {
  final buffer = [...this];
  buffer.sort(compare);
  return buffer;
}