String formatWithCommasHelper(String num) { RegExp exp = RegExp(r'(\d)(?=(\d{3})+(?!\d))'); return num.replaceAllMapped(exp, (Match match) => '${match.group(1)},'); }