sendAndWaitForResult method
Sends an event and waits until a non-waiting status is emitted.
Useful for testing async operations that go through waiting states.
event - The event to send.
timeout - Maximum time to wait (default 5 seconds).
Implementation
Future<StreamStatus<TState>> sendAndWaitForResult(
EventBase event, {
Duration timeout = const Duration(seconds: 5),
}) async {
final future =
bloc.stream.firstWhere((s) => s is! WaitingStatus).timeout(timeout);
await bloc.send(event);
return await future;
}