intersect method

Iterable<E> intersect(
  1. Iterable<E> other
)

Returns a Iterable containing all elements that are contained by both this collection and the specified collection.

Implementation

Iterable<E> intersect(Iterable<E> other) =>
    distinct.where((element) => other.contains(element));