listNfts method
Get all supported NFTs with id, contract address, name, asset platform id and symbol on CoinGecko
order
sets the sort order of responses
itemsPerPage
sets total results per page. Valid values: 1...250.
Default is 100.
page
sets page through results.
Default is 1.
Query path: /nfts/list
Implementation
Future<CoinGeckoResult<List<NftInfo>>> listNfts({
String order = NftsListOrder.marketCapUsdDescending,
int itemsPerPage = 100,
int page = 1,
}) async {
final response = await _client.dio.get(
'/nfts/list',
queryParameters: {
'order': order,
'per_page': itemsPerPage,
'page': page,
},
);
if (response.statusCode == 200) {
List<NftInfo> nftInfo = [];
final list = Convert.toListN<dynamic>(response.data);
if (list != null) {
list.forEach((value) {
nftInfo.add(NftInfo.fromJson(value));
});
}
return CoinGeckoResult(nftInfo);
} else {
return CoinGeckoResult(
[],
errorMessage: response.data.toString(),
errorCode: response.statusCode ?? null,
isError: true,
);
}
}