whereElements method
Filters the elements in each list emitted by this stream using predicate.
If predicate is null, this stream is returned unchanged.
If skipMappedToEmpty is true, when all elements in a non-empty list are
filtered out, the resulting empty list is not emitted.
Implementation
Stream<List<T>> whereElements(
bool Function(T)? predicate, {
bool skipMappedToEmpty = true,
}) {
if (predicate == null) {
return this;
}
return mapLists(
(list) => list..retainWhere(predicate),
skipMappedToEmpty: skipMappedToEmpty,
);
}