FetchPriceMultiplier static method

Future<void> FetchPriceMultiplier(
  1. String currency
)

Implementation

static Future<void> FetchPriceMultiplier(String currency) async {
  String raw_Tether_USD = await DataFetcher.fetchUrlData(
      "https://api.coingecko.com/api/v3/simple/price?ids=tether&vs_currencies=usd");
  String raw_Tether_Currency = await DataFetcher.fetchUrlData(
      "https://api.coingecko.com/api/v3/simple/price?ids=tether&vs_currencies=" +
          currency);

  raw_Tether_USD = raw_Tether_USD.split("{")[2].split("}")[0].split(":")[1];
  raw_Tether_Currency =
      raw_Tether_Currency.split("{")[2].split("}")[0].split(":")[1];

  double Tether_USD = double.parse(raw_Tether_USD);
  double Tether_Currency = double.parse(raw_Tether_Currency);

  Cryptocurrency.currentPriceMultiplier = Tether_Currency / Tether_USD;
}