Return a new array that is sorted by the compare function
compare
List<E> sorted([int Function(E a, E b)? compare]) { final items = toList(); items.sort(compare); return items; }