cake_wallet/lib/entities/calculate_fiat_amount_raw.dart

13 lines
277 B
Dart
Raw Normal View History

2022-10-12 17:09:57 +00:00
String calculateFiatAmountRaw({required double cryptoAmount, double? price}) {
2020-01-04 19:31:52 +00:00
if (price == null) {
return '0.00';
}
final result = price * cryptoAmount;
if (result == 0.0) {
return '0.00';
}
return result > 0.01 ? result.toStringAsFixed(2) : '< 0.01';
}