Last active
April 26, 2019 11:13
-
-
Save piscis/412ed128bfafe2f08fa81b820f56f9ba to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import 'dart:async'; | |
// This is a workaround because sleep from dart:io breaks DartPad instead we're using a Future | |
Future sleep1() { | |
return new Future.delayed(const Duration(seconds: 1), () => "1"); | |
} | |
void main() { | |
do_long_running_fancy_stuff() { | |
print("FANCY STUFF DONE1"); | |
sleep1(); | |
print("FANCY STUFF DONE2"); | |
sleep1(); | |
print("NOW IM DONE"); | |
} | |
Future foobar() { | |
return new Future(() { | |
do_long_running_fancy_stuff(); | |
}); | |
} | |
foobar(); | |
print("I'M DONE ... but wait ..."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment