listCoins method
List all supported coins id, name and symbol.
includePlatforms
sets whether platform information
should be included. Default is false.
Query path: /coins/list
Implementation
Future<CoinGeckoResult<List<CoinShort>>> listCoins({
bool includePlatforms = false,
}) async {
final response = await _client.dio.get(
'/coins/list',
queryParameters: {
'include_platform': includePlatforms,
},
);
if (response.statusCode == 200) {
List<CoinShort> coinList = [];
for (dynamic coinJson in response.data) {
coinList.add(CoinShort.fromJson(coinJson));
}
return CoinGeckoResult(coinList);
} else {
return CoinGeckoResult(
[],
errorMessage: response.data.toString(),
errorCode: response.statusCode ?? 0,
isError: true,
);
}
}