Skip to content

Instantly share code, notes, and snippets.

@bapspatil
Last active March 21, 2019 08:53
Show Gist options
  • Save bapspatil/939cf3764d468e41e021a7600f13c35a to your computer and use it in GitHub Desktop.
Save bapspatil/939cf3764d468e41e021a7600f13c35a to your computer and use it in GitHub Desktop.
API call to get quotes for Kut In.
Future<void> getQuote() async {
String baseUrl = 'http://api.kanye.rest/';
try {
http.Response response = await http.get(baseUrl);
var myQuote = Quote.fromJson(jsonDecode(response.body));
setState(() {
_quote = myQuote.quote;
_gradientColors.shuffle(_random);
_colorOne = _gradientColors[0];
_colorTwo = _gradientColors[1];
});
} catch (e) {
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment