Created
July 31, 2019 14:41
-
-
Save agarasul/2767c6eb6e2c3c443096e013183e61b8 to your computer and use it in GitHub Desktop.
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 getData() async { | |
var response = await http.get( | |
"https://newsapi.org/v2/top-headlines?country=us&apiKey=821a22ad51e240fb9c131c4b00009630"); | |
setState(() { | |
if (response.statusCode == 200) { | |
items.addAll(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