formatWithCurrency method

  1. @override
String formatWithCurrency(
  1. double value, [
  2. Currency? curr,
  3. int numberOfDecimals = 2,
  4. bool ignoreDecimalIfZero = true,
])
override

Implementation

@override
String formatWithCurrency(double value,
    [Currency? curr,
    int numberOfDecimals = 2,
    bool ignoreDecimalIfZero = true]) {
  final currency = curr ?? getCurrencyByCodeOrDefault();

  return '${currency.symbolPosition.isBefore ? currency.symbol : ''}${value.format(numberOfDecimals, ignoreDecimalIfZero)}${currency.symbolPosition.isAfter ? ' ${currency.symbol}' : ''}';
}