mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-18 02:07:37 +00:00
14 lines
No EOL
329 B
Dart
14 lines
No EOL
329 B
Dart
String calculateFiatAmount({double price, String cryptoAmount}) {
|
|
if (price == null || cryptoAmount == null) {
|
|
return '0.00';
|
|
}
|
|
|
|
final _amount = double.parse(cryptoAmount);
|
|
final result = price * _amount;
|
|
|
|
if (result == 0.0) {
|
|
return '0.00';
|
|
}
|
|
|
|
return result > 0.01 ? result.toStringAsFixed(2) : '< 0.01';
|
|
} |