intersection method

  1. @useResult
List<T> intersection(
  1. Iterable<T> other
)

Elements that appear in both this and other.

Returns a new list of elements present in both iterables.

Implementation

@useResult
List<T> intersection(Iterable<T> other) {
  final Set<T> otherSet = other.toSet();
  return where((T x) => otherSet.contains(x)).toList();
}