formatMoney method

String formatMoney(
  1. dynamic value
)

Formats a dynamic value as a currency string in Brazilian Real (BRL).

The value is first parsed to a double. The format used is "R$ #,##0.00".

Implementation

String formatMoney(dynamic value) {
  double dValue = parseDouble(value);

  final formatter = NumberFormat("#,##0.00", "pt_BR");
  String newText = "R\$ " + formatter.format(dValue);
  return newText;
}