mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
* feat: Mask fiat amounts to be more readable, with comma formating for large numbers * fix: Add fiat masking to buy and sell
15 lines
333 B
Dart
15 lines
333 B
Dart
import 'calculate_fiat_amount.dart';
|
|
|
|
String calculateFiatAmountRaw({required double cryptoAmount, double? price}) {
|
|
if (price == null) {
|
|
return '0.00';
|
|
}
|
|
|
|
final result = price * cryptoAmount;
|
|
|
|
if (result == 0.0) {
|
|
return '0.00';
|
|
}
|
|
|
|
return result > 0.01 ? formatWithCommas(result.toStringAsFixed(2)) : '< 0.01';
|
|
} |