cond method
Returns the value of the Pod when the test
returns true
.
Implementation
FutureOr<T> cond(bool Function(T value) test) {
final completer = CompleterOr<T>();
void check() {
if (test(value)) {
completer.complete(value);
}
}
check();
if (completer.isCompleted) {
return value;
} else {
// ignore: deprecated_member_use_from_same_package
addListener(check);
return consec(completer.futureOr, (e) {
removeListener(check);
return e;
});
}
}