Created
October 18, 2023 15:12
-
-
Save karabanovbs/5d8acdfe9f68209738f4221a3ac112f9 to your computer and use it in GitHub Desktop.
test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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