asyncWhen function
Future<void>
asyncWhen(
- bool predicate(), {
- String? name,
- int? timeout,
- ReactiveContext? context,
A variant of when() which returns a Future. The Future completes when the predicate()
turns true.
Note that there is no effect function here. Typically you would await on the Future and execute the
effect after that.
await asyncWhen((_) => x.value > 10);
// ... execute the effect ...
Implementation
Future<void> asyncWhen(bool Function(Reaction) predicate,
{String? name, int? timeout, ReactiveContext? context}) =>
createAsyncWhenReaction(context ?? mainContext, predicate,
name: name, timeout: timeout);