localizationCheckForNumber function

dynamic localizationCheckForNumber(
  1. dynamic data
)

localizationCheckForNumber method to check the number for localization This method is used to check the number for localization This is very useful for localization This method is can be uses for any number Here locale is used to check the locale If the locale is 'bn_BD' then the number will be converted to Bengali number Here using banNumber is used to convert the number to Bengali number Inside banNumber method numberMultiLan is used to convert the number to Bengali number This method is a global method This method is used in many places

Example:

localizationCheckForNumber(1234.56);

Implementation

dynamic localizationCheckForNumber(dynamic data) {
  if (data == null) return null;
  if (locale != null && locale.toString() == const Locale('bn_BD').toString()) {
    if (data.toString().contains('.00')) {
      return banNumber(data);
    } else if (data.toString().contains('.0')) {
      data = data.toString().replaceAll('.0', '.00');
      return banNumber(data);
    } else {
      return banNumber(data);
    }
  } else {
    return data;
  }
}