Until<T>.changed constructor

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

Creates an Until that waits for source to change from its current value.

Captures the value at creation time and completes when source holds a different value (using != for comparison). Useful for waiting for the next transition.

Example:

final status = Signal('idle');
status.value = 'loading';
final next = await Until.changed(status); // Waits for status != 'loading'

Implementation

factory Until.changed(ReadableNode<T> source, {bool? detach}) {
  final current = source.value;
  return Until<T>(source, (v) => v != current, detach: detach);
}