Last active
April 9, 2018 04:32
-
-
Save Elvis10ten/ee813a853d80dda0f51090f62221b48e to your computer and use it in GitHub Desktop.
Note: 'http.dart' is a composable, Future-based library for making HTTP requests.
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
Future<List> getCurrencies() async { | |
String apiUrl = 'https://api.coinmarketcap.com/v1/ticker/?limit=50'; | |
// Make a HTTP GET request to the CoinMarketCap API. | |
// Await basically pauses execution until the get() function returns a Response | |
http.Response response = await http.get(apiUrl); | |
// Using the JSON class to decode the JSON String | |
return JSON.decode(response.body); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JSON
is deprecated. I'm now usingjson
instead.