How to test if stream emits a value at a particular position in Dart?
You can use elementAt
or skip first 3 values of the stream and check emitted item:
test('stream', () async { Stream<int> stream() => Stream.fromIterable([1, 2, 3, 4, 5]); expect(await stream().elementAt(3), 4); expect(stream().skip(3), emitsInOrder(<dynamic>[4])); expect(stream().skip(3), emits(4));});