getCryptocurrencies method
Implementation
@override
Future<List<Cryptocurrency>> getCryptocurrencies() async {
final String response = await DataFetcher.fetchUrlData(url);
var cryptoList = <Cryptocurrency>[];
Map<String, dynamic> cryptomap = jsonDecode(response);
for (final item in cryptomap["coins"]) {
var crypto = Cryptocurrency(
id: item['id'],
name: item['name'],
symbol: item['symbol'],
image: item['icon'],
currentPriceUSD: item['price'],
marketCap: item['marketCap'],
marketCapRank: item['rank'],
totalVolume: item['volume'],
priceChange24h: item['priceChange1d'],
totalSupply: item['totalSupply'],
);
cryptoList.add(crypto);
}
return cryptoList;
}