slice method
Returns a new set with elements at the specified indices.
Example:
final set = {10, 20, 30, 40, 50};
print(set.slice(1, 3)); // {20, 30}
Implementation
Set<E> slice(int start, [int? end]) {
final list = toList();
end ??= list.length;
return Set.from(list.sublist(start, end));
}