Skip to content

Instantly share code, notes, and snippets.

@purplecandy
Created April 7, 2020 09:51
Show Gist options
  • Save purplecandy/4bf516fc43a61d4a8ad5870e61eeb1e4 to your computer and use it in GitHub Desktop.
Save purplecandy/4bf516fc43a61d4a8ad5870e61eeb1e4 to your computer and use it in GitHub Desktop.
Dart async/await operation
void main(){
results();
}
void results()async{
await printNumber("A",100);
printNumber("B",200);
}
Future<void> printNumber(var a,int delay)async{
for(int i=0;i<5;i++){
await Future.delayed(Duration(milliseconds: delay));
print("$a -> $i");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment