slice method

Set<E> slice(
  1. int start, [
  2. int? end
])

Returns a new set with elements at the specified indices.

Implementation

Set<E> slice(int start, [int? end]) {
  final list = toList();
  end ??= list.length;
  return Set.from(list.sublist(start, end));
}