Created
April 7, 2020 09:51
-
-
Save purplecandy/4bf516fc43a61d4a8ad5870e61eeb1e4 to your computer and use it in GitHub Desktop.
Dart async/await operation
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(){ | |
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