symmetricDifference method

  1. @useResult
List<T> symmetricDifference(
  1. Iterable<T> other
)

Symmetric difference: elements in this or other but not in both.

Implementation

@useResult
List<T> symmetricDifference(Iterable<T> other) {
  final Set<T> a = toSet();
  final Set<T> b = other.toSet();
  return <T>[...a.where((T x) => !b.contains(x)), ...b.where((T x) => !a.contains(x))];
}