Simple dart problem, got a stream
Stream<Event>
I subscribe to in a unit test. Would like something like this:
stream.listen(listener)
await listenerBeenNotified5Times
expect(result,expectation)
I know expectAsync can be used to make sure the notification happens 5 times, but I want to wait to pause the execution until 5 events have been streamed.
var s = stream.take(5);
var subscription = s.listen(listener);
await susciption.asFuture;
or
await stream.take(5).toList();