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;
  final format = NumberFormat.currency(
    locale: locale,
    symbol: symbol,
    decimalDigits: 0,
  );
  return format.format(value);
}