asyncWhen function Null safety

Future<void> asyncWhen(
  1. bool predicate(
    1. Reaction
  2. {String? name,
  3. int? timeout,
  4. 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 ...


Future<void> asyncWhen(bool Function(Reaction) predicate,
        {String? name, int? timeout, ReactiveContext? context}) =>
    createAsyncWhenReaction(context ?? mainContext, predicate,
        name: name, timeout: timeout);