waitForValue method
Completes when targetValue is observed on the stream.
Resolves immediately if the current value already matches (BehaviorSubject replay).
Uses == for comparison.
Throws TimeoutException if timeout elapses (default 5 s).
Implementation
Future<void> waitForValue(
T targetValue, {
Duration timeout = const Duration(seconds: 5),
}) =>
_waitForValueOnStream<T>(stream, targetValue, timeout);