until method

Until<T> until(
  1. bool predicate(
    1. T value
    ), {
  2. bool? detach,
})

Waits until the value satisfies a condition.

Returns an Until that implements Future and can be awaited. The returned value also has a Until.cancel method to stop waiting and dispose the effect when the predicate will never be satisfied.

Parameters:

  • predicate: Function that returns true when condition is met
  • detach: If true, the effect will not be bound to the current scope

Returns: An Until that completes with the value when condition is satisfied

Example:

final count = Signal(0);
final until = count.until((value) => value >= 5);
// await until; // wait for condition
// until.cancel(); // or cancel to stop waiting

Implementation

Until<T> until(bool Function(T value) predicate, {bool? detach}) =>
    Until<T>(this, predicate, detach: detach);