expectEmits method
Collects the next expected.length emissions from stream and verifies
they match expected in order.
The BehaviorSubject replay counts as the first emission.
Throws StateError if values don't match.
Throws TimeoutException if not enough emissions arrive within timeout.
An empty expected list completes immediately.
Implementation
Future<void> expectEmits(
List<T> expected, {
Duration timeout = const Duration(seconds: 5),
}) =>
_expectEmitsOnStream<T>(stream, expected, timeout);