Last active
August 15, 2020 12:28
-
-
Save nsmirosh/9947530068d9b875048b53cb50641813 to your computer and use it in GitHub Desktop.
Future with then and showing a null return type
This file contains 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() { | |
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