waitTillEventIsReceived method
Waits till given event is received by this instance
event
- event type to check
count
- optional count of events that must have been received
timeout
- maximum duration to wait for events
Implementation
@visibleForTesting
Future<void> waitTillEventIsReceived(
Type event, {
int? count,
Duration timeout = const Duration(seconds: 1),
}) async {
await for (final _ in _testReceivedEventsController.stream
.timeout(timeout, onTimeout: (s) => s.close())) {
if (checkEventWasReceived(event, count: count)) {
break;
}
}
}