Skip to content

Instantly share code, notes, and snippets.

@Abhilash-Chandran
Created August 5, 2019 17:25
Show Gist options
  • Save Abhilash-Chandran/59610dc768e232ac5a8e724f7fe0eee6 to your computer and use it in GitHub Desktop.
Save Abhilash-Chandran/59610dc768e232ac5a8e724f7fe0eee6 to your computer and use it in GitHub Desktop.
void main() {
var futureObject = getPostFromServer();
printPost(futureObject);
}
getPostFromServer() async {
var duration = Duration(seconds: 5);
var computation = () {
return "You will get it in future";
};
var futureObject = await Future.delayed(duration, computation);
return futureObject;
}
printPost(var futureObject) async {
print(await futureObject);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment