changeLocale method

void changeLocale(
  1. BuildContext context,
  2. Locale newLocale
)

Changes the current locale, reloading all necessary translations and triggering a UI rebuild.

Implementation

void changeLocale(BuildContext context, Locale newLocale) {
  logger.log("Changing locale to: ${newLocale.toLanguageTag()}");
  currentLocale = newLocale;
  loadInitialTranslations(newLocale, _includedTranslations);
  (context as Element).markNeedsBuild();
}