union method Null safety

  1. @override
Set<String?> union(
  1. Set<String?> other
)
override

Creates a new set which contains all the elements of this set and other.

That is, the returned set contains all the elements of this Set and all the elements of other.

final characters1 = <String>{'A', 'B', 'C'};
final characters2 = <String>{'A', 'E', 'F'};
final unionSet1 = characters1.union(characters2);
print(unionSet1); // {A, B, C, E, F}
final unionSet2 = characters2.union(characters1);
print(unionSet2); // {A, E, F, B, C}

Implementation

@override
Set<String?> union(Set<String?> other) => _inner.union(other);