Skip to content

Commit

Permalink
refactor: rename variable name to more readable form
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar-deriv committed Jun 24, 2024
1 parent 3ebd2c5 commit 235fe96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ class ExchangeController extends ChangeNotifier {
/// what user send by default in primaryCurrency when coming to numpad.)
double finalAmount() {
if (_exchangeRate.baseCurrency == primaryCurrency.currencyType) {
return primaryCurrency.finalAmount;
return primaryCurrency.formattedAmount;
} else {
return secondaryCurrency.finalAmount;
return secondaryCurrency.formattedAmount;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@ class CurrencyDetail {
bool get isFiat => fiatCurrencies.contains(currencyType);

/// This will check if the currency is stable coin currency(USDC,tUSDT,eUSDT) or not.
bool get isStableCurrency =>
bool get isStableCryptoCurrency =>
stableCurrencies.contains(currencyType.toUpperCase());

/// This will give the final amount to do processing based on what type of currency it is like fiat or crypto currency.
double get finalAmount => double.parse(formatter.format(amount));
double get formattedAmount => double.parse(formatter.format(amount));

/// Amount that is used to display for user.
String get displayAmount {
if (amount == 0.0) {
return '';
}

return isFiat || isStableCurrency
return isFiat || isStableCryptoCurrency
? amount.toStringAsFixed(2)
: amount.toStringAsFixed(8);
}

/// This will give a specific currency formatter based on what type of currency it is like fiat or crypto currency.
NumberFormat get formatter {
if (isFiat || isStableCurrency) {
if (isFiat || isStableCryptoCurrency) {
return NumberFormat('#0.##', 'en_US');
} else {
return NumberFormat('#0.########', 'en_US');
Expand Down

0 comments on commit 235fe96

Please sign in to comment.