Skip to content

Instantly share code, notes, and snippets.

@karabanovbs
Created September 8, 2022 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karabanovbs/87b7fa0bc4a47b79cc0c7a74ca3fbf63 to your computer and use it in GitHub Desktop.
Save karabanovbs/87b7fa0bc4a47b79cc0c7a74ca3fbf63 to your computer and use it in GitHub Desktop.
import 'dart:async';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('test case', () async {
await expectLater(
// create stream that emit Completer, and wait it
((() async* {
try {
final completer = Completer<void>();
yield completer;
await completer.future;
} catch (_) {
// handle error
}
})())
.map((event) {
// add error to completer
event.completeError(Exception());
return event;
}),
emitsThrough(anything),
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment