intersectWith method

Iterable<T> intersectWith(
  1. Iterable<T> other
)

Returns a set of elements that are common between this iterable and other.

Example:

Iterable<int?>? numbers = [1, 2, 3];
print(numbers.intersectWith([2, 3, 4]));  // Output: {2, 3}

Implementation

Iterable<T> intersectWith(Iterable<T> other) =>
    validate().toSet().intersection(other.toSet());