unionWhere method

List<T> unionWhere(
  1. List<T> other,
  2. bool test(
    1. T element
    )
)

Returns a new list which contains all the elements of filtered this list by test and other.

That is, the returned list contains all the elements of this list and all the elements of other.

Note that filtering is applied to both this and other Iterables.

Note that this list and other will be cleared from item duplicates.

Implementation

List<T> unionWhere(List<T> other, bool test(T element)) =>
    this.where(test).toSet().union(other.where(test).toSet()).toList();