cryptoToDollars static method
Convert crypto asset value to dollars
slug
is the slug of the crypto asset, e.g bitcoin, etherum, etc.
assetVal
is the crypto asset value.
Returns the converted value in dollars.
Implementation
static Future<double> cryptoToDollars(String slug, double assetVal,
{bool useCache = true}) async {
if (_xRateMap.containsKey(slug)) {
return _xRateMap[slug]! * assetVal;
} else {
AssetMetricsResponse response = await getMetrics(slug);
return response.assetMetric.marketData.priceUsd * assetVal;
}
}