toVnd static method

String toVnd(
  1. int value, {
  2. bool emptyToZero = true,
})

Implementation

static String toVnd(int value, {bool emptyToZero = true}) {
  String empty = emptyToZero ? '0' : '';

  try {
    NumberFormat formatter = NumberFormat('#,###', 'en_US');
    String currency = formatter.format(value);

    return currency != '0' ? currency : empty;
  } catch (e) {
    return empty;
  }
}