formatCurrency method
Formats the number as currency.
Example:
1234.formatCurrency(); // '\$1,234.00'
1234.formatCurrency(symbol: '€'); // '€1,234.00'
Implementation
String formatCurrency({String symbol = '\$', int decimals = 2}) {
return '$symbol${formatWithSeparator()}.${decimals.toString().padLeft(decimals, '0')}';
}