getPrice function

String getPrice(
  1. String text
)

Implementation

String getPrice(String text) {
    if(text.isNotEmpty)
    {
      try {
        var formatter = NumberFormat('#,##,###');
        return "₹ ${formatter.format(double.parse(text))}";
      } catch (e) {
        return "₹ $text";
      }
    }
    else
    {
      return "₹ $text";
    }
}