filteredBy<R> method

Stream<Iterable<X>> filteredBy<R>(
  1. Stream<R> other,
  2. bool filter(
    1. X item,
    2. R other
    )
)

Filters this stream using a result of another stream. This allows us to apply the filter when either the filtering source changes or the original list changes.

Implementation

Stream<Iterable<X>> filteredBy<R>(
    Stream<R> other, bool filter(X item, R other)) {
  return this.combineLatest(other, (Iterable<X> items, R other) {
    return items.where((item) => filter(item, other));
  });
}