Skip to content

Instantly share code, notes, and snippets.

@ybakos
Last active February 24, 2020 01:35
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 ybakos/7efb1d24bd4ea1d8ff2667c8a093e9eb to your computer and use it in GitHub Desktop.
Save ybakos/7efb1d24bd4ea1d8ff2667c8a093e9eb to your computer and use it in GitHub Desktop.
CS 492 Week 8 Exploration 2 Exercise Async
void main() {
print('a');
// TODO: Do the same work, but without the use of `go`.
go().then( (value) {
print(value);
});
print('b');
}
Future<int> go() {
return Future(longRunner);
}
int longRunner() {
for (var i = 0; i < 5000; ++i) {
}
return 42;
}
void main() {
print('a');
Future(longRunner).then( (value) {
print(value);
});
print('b');
}
int longRunner() {
for (var i = 0; i < 5000; ++i) {
}
return 42;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment