untilState<K extends Object, V> function
FutureOr<void>
untilState<K extends Object, V>(
- BaseResourceBloc<
K, V> bloc, - UntilCondition<
K, V> condition
Returns a future that finishes when the bloc's state passes the condition check.
Implementation
FutureOr<void> untilState<K extends Object, V>(
BaseResourceBloc<K, V> bloc,
UntilCondition<K, V> condition,
) {
if (!condition(bloc.state)) {
return bloc.stream.firstWhere(condition).then((_) {});
}
}