Skip to content

Instantly share code, notes, and snippets.

@agarasul
Last active August 1, 2019 05:46
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 agarasul/536ff3ba820d66fb295456f5d066afb4 to your computer and use it in GitHub Desktop.
Save agarasul/536ff3ba820d66fb295456f5d066afb4 to your computer and use it in GitHub Desktop.
void getData() async {
http.Response response = await http.get(
"https://newsapi.org/v2/top-headlines?country=us&apiKey=YOUR_API_KEY");
setState(() {
_newsList = News.fromJson(json.decode(response.body)).articles;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment