toSet method Null safety

  1. @override
Set<E> toSet()
override

Creates a Set with the same elements and behavior as this Set.

The returned set behaves the same as this set with regard to adding and removing elements. It initially contains the same elements. If this set specifies an ordering of the elements, the returned set will have the same order.

Implementation

@override
Set<E> toSet() {
  return value.toSet();
}