toCurrency method

String toCurrency({
  1. String locale = 'en_US',
  2. String symbol = '\$',
})

Implementation

String toCurrency({String locale = 'en_US', String symbol = '\$'}) {
  final value = this ?? 0.0;
  final format = NumberFormat.currency(locale: locale, symbol: symbol);
  return format.format(value);
}