Skip to content

Instantly share code, notes, and snippets.

@Muneefm
Created October 3, 2018 23:31
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 Muneefm/7e6ee8e9e05eb05999c543ed55cde3db to your computer and use it in GitHub Desktop.
Save Muneefm/7e6ee8e9e05eb05999c543ed55cde3db to your computer and use it in GitHub Desktop.
void _requestData() async {
final response = await http.get('$_url');
if (response.statusCode == 200) {
// If server returns an OK response, parse the JSON
Movie movie = Movie.fromJson(json.decode(response.body));
setState(() {
_name = movie.title;
_imagePath = movie.image;
});
} else {
// handle network error
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment