subtract method
Creates a new Set that contains all the elements of the current Set except for the elements
that are also present in the other Iterable.
The function creates a new Set by converting the current Set to a Set using the toSet() method.
It then removes all the elements present in the other Iterable using the removeAll() method of the Set.
Returns a new Set that contains the elements of the current Set except for the elements in the other Iterable.
Example:
Set<int> set1 = {1, 2, 3, 4, 5};
Set<int> set2 = {3, 4, 5, 6, 7};
Set<int> difference = set1.subtract(set2);
print(difference); // Output: {1, 2}
Implementation
subtract(Iterable<T> other) {
final set = toSet();
set.removeAll(other);
return set;
}