toCurrencyString method

String toCurrencyString({
  1. String locale = 'en_US',
  2. String symbol = '\$',
  3. int fractionDigits = 2,
})

Implementation

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