Last active
June 29, 2021 03:57
-
-
Save cmc5788/37cda5d43194ff586e388d0fd2253bca to your computer and use it in GitHub Desktop.
Leaked stream in async
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'; | |
Future<void> foo() async { | |
await for (final i in Stream<int>.periodic(const Duration(milliseconds: 500), (x) => x)) { | |
print('$i'); | |
} | |
} | |
void main() async { | |
// once this is awaited, the inner implicit stream subscription is uncancalleble | |
await foo(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment