mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-10-31 09:27:40 +00:00
16 lines
No EOL
645 B
Dart
16 lines
No EOL
645 B
Dart
import 'package:intl/intl.dart';
|
|
import 'package:cake_wallet/entities/crypto_amount_format.dart';
|
|
|
|
const bitcoinAmountLength = 8;
|
|
const bitcoinAmountDivider = 100000000;
|
|
final bitcoinAmountFormat = NumberFormat()
|
|
..maximumFractionDigits = bitcoinAmountLength
|
|
..minimumFractionDigits = 1;
|
|
|
|
String bitcoinAmountToString({int amount}) =>
|
|
bitcoinAmountFormat.format(cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider));
|
|
|
|
double bitcoinAmountToDouble({int amount}) => cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider);
|
|
|
|
int doubleToBitcoinAmount(double amount) =>
|
|
(amount * bitcoinAmountDivider).toInt(); |