formatNumber static method

String formatNumber(
  1. int number
)

Format a number with thousands separators.

Implementation

static String formatNumber(int number) {
  return number.toString().replaceAllMapped(RegExp(r'(\d)(?=(\d{3})+(?!\d))'), (match) => '${match[1]},');
}