setLocale method

void setLocale(
  1. Locale locale
)

Implementation

void setLocale(Locale locale) async{
  if (! ['en','or','hi', 'od', 'pa', 'gu', 'mr', 'te', 'ta', 'as', 'bn', 'ml', 'kn', 'ur', 'mai', 'sa', 'kok', 'ks'].contains(locale.languageCode)) return; // Ensure locale is supported
  await AppLocalizations(locale).load();
  _locale = locale;
  notifyListeners(); // Notify listeners to rebuild
}