moneyFormat method

String moneyFormat({
  1. String device = '',
  2. int round = 1,
})

Implementation

String moneyFormat({String device= '',int round= 1}) {
  NumberFormat numberFormat = NumberFormat("#,##0.${round>0?'0'*round:'0'}", "en_US");
  return isNotEmpty
      ? numberFormat.format(double.parse(this)) + "  " + device
      : '0.0';
}