subtract method

dynamic subtract(
  1. Iterable<T> other
)

Returns a set containing all elements that are contained by this collection and not contained by the specified collection. The returned set preserves the element iteration order of the original collection.

example:

1,2,3,4,5,6.subtract(4,5,6)

result: 1,2,3

Implementation

subtract(Iterable<T> other) {
  final set = toSet();
  set.removeAll(other);
  return set;
}