priceFormat2 static method

String priceFormat2({
  1. required double? price,
})

Implementation

static String priceFormat2({required double? price}) {
  if (price != null && price != 0) {
    price = price / 1000;
    final currencyFormatter =
        NumberFormat(price < 1000 ? '###.0#' : "#,###", 'VI');
    return currencyFormatter.format(price) + "K";
  } else {
    return "0đ";
  }
}