numberToLocale function

String numberToLocale(
  1. String str,
  2. Locale locale

localize numbers base on locale if none provided it will use the app locale Nations.locale Make sure you know the difference between arabic and hindi numbers


String numberToLocale(String str, Locale locale) {
  if (str.isEmpty) return str;
  switch (locale.languageCode) {
    case 'ar':
      return convertToArabicNumbers(str);
    case 'hi':
      return convertToHindiNumbers(str);
  return str;