getExchangeData method

Future<CoinGeckoResult<ExchangeExtended?>> getExchangeData({
  1. required String id,
})

Get exchange volume in BTC and top 100 tickers only.

id sets the exchange id.

Query: /exchanges/{id}

Implementation

Future<CoinGeckoResult<ExchangeExtended?>> getExchangeData({
  required String id,
}) async {
  final response = await _dio.get(
    '/exchanges/$id',
  );
  if (response.statusCode == 200) {
    final info = ExchangeExtended.fromJson(response.data);
    return CoinGeckoResult(info);
  } else {
    return CoinGeckoResult(
      null,
      errorCode: response.statusCode ?? null,
      errorMessage: '${response.statusMessage} - ${response.data.toString()}',
      isError: true,
    );
  }
}