listCategoriesShort method
List all categories.
Query: /coins/categories/list
Implementation
Future<CoinGeckoResult<List<CategoryShort>>> listCategoriesShort() async {
final response = await _dio.get(
'/coins/categories/list',
);
if (response.statusCode == 200) {
final list = Convert.toListN(response.data);
final List<CategoryShort> categoryList = list != null
? list.map((e) => CategoryShort.fromJson(e)).toList()
: [];
return CoinGeckoResult(categoryList);
} else {
return CoinGeckoResult(
[],
errorMessage: response.data.toString(),
errorCode: response.statusCode ?? null,
isError: true,
);
}
}