mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-23 10:45:27 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
20 lines
384 B
Dart
20 lines
384 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.isFinite) {
|
|
return '0.00';
|
|
}
|
|
|
|
if (result == 0.0) {
|
|
return '0.00';
|
|
}
|
|
|
|
return result > 0.01 ? formatWithCommas(result.toStringAsFixed(2)) : '< 0.01';
|
|
}
|