sorted method
Returns a new set with elements sorted by the given compare
function.
Example:
final set = {3, 1, 2};
print(set.sorted()); // {1, 2, 3}
Implementation
Set<E> sorted([int Function(E a, E b)? compare]) {
final list = toList()..sort(compare);
return Set.from(list);
}