Last active
February 24, 2020 01:35
-
-
Save ybakos/7efb1d24bd4ea1d8ff2667c8a093e9eb to your computer and use it in GitHub Desktop.
CS 492 Week 8 Exploration 2 Exercise Async
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
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; | |
} |
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
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