Skip to content

Instantly share code, notes, and snippets.

@lablnet
Created October 14, 2020 12:03
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 lablnet/8d58b01d151e33cb49c02ef09daad417 to your computer and use it in GitHub Desktop.
Save lablnet/8d58b01d151e33cb49c02ef09daad417 to your computer and use it in GitHub Desktop.
import 'dart:async';
Future longRunningOperation() async {
for (int i = 0; i < 5; i++) {
await Future.delayed(Duration(seconds: 1));
print("index: $i");
}
}
main() {
print("start of long running operation");
longRunningOperation();
print("continuing main body");
for (int i = 10; i < 15; i++) {
//sleep(Duration(seconds: 1));
print("index from main: $i");
}
print("end of main");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment