formatNumberWithComma method

String formatNumberWithComma({
  1. String seperator = ',',
})

for ex. add comma in price

Implementation

String formatNumberWithComma({String seperator = ','}) {
  return this.validate().replaceAllMapped(
      RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
      (Match m) => '${m[1]}$seperator');
}