waitUntil method

Future<EffectCommandState<A, E>> waitUntil(
  1. bool where(
    1. EffectCommandState<A, E> state
    ), {
  2. Duration timeout = const Duration(seconds: 5),
})

Wait until the current or a future state satisfies where.

Implementation

Future<EffectCommandState<A, E>> waitUntil(
  bool Function(EffectCommandState<A, E> state) where, {
  Duration timeout = const Duration(seconds: 5),
}) {
  _ensureOpen();

  final current = command.value;
  if (where(current)) {
    return Future<EffectCommandState<A, E>>.value(current);
  }

  return _wait(where, timeout: timeout);
}