filter method
Create a derived pod, that filters the values using the given predicate.
Implementation
PodFuture<Pod<T>, AsyncValue<T>> filter(
bool Function(T value) predicate,
) =>
PodFuture(
this,
(ref, parent) {
ref.subscribe(
parent,
(T val) {
if (predicate(val)) {
ref.setSelf(AsyncValue.data(val));
}
},
fireImmediately: true,
);
return ref.self() ?? const AsyncValue.loading();
},
);