Created with <3 with dartpad.dev.
Created
October 6, 2023 14:59
-
-
Save MelvinRB27/638fcbab3e4ebf3701416e3b1037e68d to your computer and use it in GitHub Desktop.
async*
This file contains 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
void main() { | |
emit().listen((value){ | |
print('Valor: $value'); | |
}); | |
} | |
Stream<int> emit() async* { | |
final numbers = [1, 2, 3, 4, 5]; | |
for(int n in numbers) { | |
await Future.delayed(const Duration(seconds: 1)); | |
yield n; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment