mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-10 04:44:43 +00:00
eb9b45360e
update code to null safety
24 lines
No EOL
719 B
Dart
24 lines
No EOL
719 B
Dart
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
|
import 'package:cake_wallet/monero/monero.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
|
|
String formatAmount(String amount) {
|
|
if ((!amount.contains('.'))&&(!amount.contains(','))) {
|
|
return amount + '.00';
|
|
} else if ((amount.endsWith('.'))||(amount.endsWith(','))) {
|
|
return amount + '00';
|
|
}
|
|
return amount;
|
|
}
|
|
|
|
double formatAmountToDouble({required WalletType type, required int amount}) {
|
|
if (type == WalletType.bitcoin || type == WalletType.litecoin) {
|
|
return bitcoin!.formatterBitcoinAmountToDouble(amount: amount);
|
|
}
|
|
|
|
if (type == WalletType.monero) {
|
|
return monero!.formatterMoneroAmountToDouble(amount: amount);
|
|
}
|
|
|
|
return 0.0;
|
|
} |