thousandsSeparator method

String thousandsSeparator({
  1. String separator = ',',
})

for ex. add comma in price

Implementation

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