toNumberFormat method

String toNumberFormat({
  1. bool? showHundredth,
  2. bool? showCurrencySymbol,
  3. String currencySymbol = '₽',
})

Implementation

String toNumberFormat({bool? showHundredth, bool? showCurrencySymbol, String currencySymbol = '₽'}) {
  NumberFormat formatter;
  String result;
  if (showHundredth == true) {
    formatter = NumberFormat("#,##0.00", "ru_RU");
  } else {
    formatter = NumberFormat("#,##0", "ru_RU");
  }
  if (showCurrencySymbol == true) {
    result = formatter.format(this) + ' ' + currencySymbol;
  } else {
    result = formatter.format(this);
  }
  return result;
}