symmetricDifference method

Set<E> symmetricDifference(
  1. Set<E> other
)

Returns the elements present in exactly one of the two sets.

Example:

{1, 2, 3}.symmetricDifference({2, 3, 4}); // {1, 4}

Implementation

Set<E> symmetricDifference(Set<E> other) =>
    difference(other).union(other.difference(this));