Skip to content

Instantly share code, notes, and snippets.

@karabanovbs
Created October 18, 2023 15:12
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/5d8acdfe9f68209738f4221a3ac112f9 to your computer and use it in GitHub Desktop.
Save karabanovbs/5d8acdfe9f68209738f4221a3ac112f9 to your computer and use it in GitHub Desktop.
test
import 'dart:async';
void main() {
// create stream that emit Completer, and wait it
((() async* {
try {
final completer = Completer<void>();
yield completer;
await completer.future;
} catch (_) {
print('catch error');
}
})())
.map((event) {
// add error to completer
event.completeError(Exception());
return event;
}).listen((_) => print('done'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment