getCurrency method

Future<Currency> getCurrency({
  1. required String currencyId,
})

Get a currency

Gets a single currency by id. Currency codes will conform to the ISO 4217 standard where possible. Currencies which have or had no representation in ISO 4217 may use a custom code.

https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getcurrency

Implementation

Future<Currency> getCurrency({
  required String currencyId,
}) async {
  var response =
      await _currenciesRestClient.getCurrency(currencyId: currencyId);

  if (response.statusCode != 200) throw response;

  return Currency.fromJson(mapDecode(response.body));
}