when function
A one-time reaction that auto-disposes when the predicate becomes true. It also
executes the effect when the predicate turns true.
You can read it as: "when predicate() turns true, the effect() is executed."
Returns a function to dispose pre-maturely.
Implementation
ReactionDisposer when(
bool Function(Reaction) predicate,
void Function() effect, {
String? name,
ReactiveContext? context,
int? timeout,
void Function(Object, Reaction)? onError,
}) => createWhenReaction(
context ?? mainContext,
predicate,
effect,
name: name,
timeout: timeout,
onError: onError,
);