Skip to content

Instantly share code, notes, and snippets.

@MelvinRB27
Created October 6, 2023 14:59
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 MelvinRB27/638fcbab3e4ebf3701416e3b1037e68d to your computer and use it in GitHub Desktop.
Save MelvinRB27/638fcbab3e4ebf3701416e3b1037e68d to your computer and use it in GitHub Desktop.
async*
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