Skip to content

Instantly share code, notes, and snippets.

@nsmirosh
Last active August 15, 2020 12:28
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 nsmirosh/9947530068d9b875048b53cb50641813 to your computer and use it in GitHub Desktop.
Save nsmirosh/9947530068d9b875048b53cb50641813 to your computer and use it in GitHub Desktop.
Future with then and showing a null return type
void main() {
final myFuture = _runTheFuture();
print('myFuture.runtimeType: ${myFuture.runtimeType}');
}
_runTheFuture() {
print('print statement before invoking the future');
Future.delayed(Duration(seconds: 2), () {
print('Future completed!');
return 12;
}).then((myValue) => print('Future value: $myValue'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment