maskedCurrencyFormat function

String maskedCurrencyFormat(
  1. dynamic n, {
  2. String locale = "pt_BR",
  3. String symbol = "R\$",
})

Outputs num formated to show in a text

Example: removeZeroDecimal(12); => R$ 0,12 Example: removeZeroDecimal(1254); => R$ 12,54 Example: removeZeroDecimal(12546); => R$ 12,54

Implementation

String maskedCurrencyFormat(n, {String locale: "pt_BR", String symbol: "R\$"}) {
  final formatCurrency = NumberFormat.currency(locale: locale, symbol: symbol);
  return formatCurrency.format(n / 100);
}