getCoinsCurrentData method

Future<CoinsCurrentDataResponse> getCoinsCurrentData()

Get Uniris Coin infos (name, price, market, ... including exchange tickers)

Implementation

Future<CoinsCurrentDataResponse> getCoinsCurrentData() async {
  CoinsCurrentDataResponse? coinsCurrentDataResponse;
  final Map<String, String> requestHeaders = {
    'Content-type': 'application/json'
  };

  try {
    final http.Response responseHttp = await http.get(
        Uri.parse('https://api.coingecko.com/api/v3/coins/uniris'),
        headers: requestHeaders);
    if (responseHttp.statusCode == 200) {
      coinsCurrentDataResponse =
          coinsCurrentDataResponseFromJson(responseHttp.body);
    }
  } catch (e) {
    logger.e(e.toString());
  }

  return coinsCurrentDataResponse!;
}