subtract method

Set<E> subtract(
  1. Iterable<E> other
)

Returns a set of elements contained in this collection but not in other. The returned set preserves the element iteration order of the original collection.

Example:

final result = [1, 2, 3, 4, 5, 6].subtract([4, 5, 6]);
// result: {1, 2, 3}

Implementation

Set<E> subtract(Iterable<E> other) => toSet()..removeAll(other);