Until<T>.when constructor

Until<T>.when(
  1. ReadableNode<T> source,
  2. T value, {
  3. bool? detach,
})

Creates an Until that waits for source to equal value.

Convenience factory for the common case of waiting for an exact value. Equivalent to Until(source, (v) => v == value, detach: detach).

Example:

final status = Signal('loading');
await Until.when(status, 'ready'); // Waits until status is 'ready'

Implementation

factory Until.when(ReadableNode<T> source, T value, {bool? detach}) =>
    Until<T>(source, (v) => v == value, detach: detach);