toUnmodifiableSet method

  1. @useResult
Set<E> toUnmodifiableSet()

Transforms this iterable into an unmodifiable Set.

See toSet for creating a modifiable Set.

{1, 2, 3}.toUnmodifiableSet(); //  {1, 2, 3}

Implementation

@useResult Set<E> toUnmodifiableSet() => Set.unmodifiable(this);