formatWithCommas static method
Format number with commas
number - The number to format
Returns formatted number string
Implementation
static String formatWithCommas(int number) {
final formatter = RegExp(r'(\d)(?=(\d{3})+(?!\d))');
return number.toString().replaceAllMapped(formatter, (match) => '${match.group(1)},');
}