Merge pull request #573 from cypherstack/handle-price_change_percentage_24h-being-null

Handle price_change_percentage_24h being null and not able to parse a…
This commit is contained in:
Diego Salazar 2023-06-06 12:50:29 -06:00 committed by GitHub
commit f032db9a6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,8 +115,8 @@ class PriceAPI {
final coin = coinFromPrettyName(coinName);
final price = Decimal.parse(map["current_price"].toString());
final change24h =
double.parse(map["price_change_percentage_24h"].toString());
final change24h = map["price_change_percentage_24h"] != null ?
double.parse(map["price_change_percentage_24h"].toString()) : 0.0;
result[coin] = Tuple2(price, change24h);
}