changeLocale function
Change the currently selected locale
Implementation
Future changeLocale(BuildContext context, String? localeCode) async {
if (localeCode != null) {
await LocalizedApp.of(context)
.delegate
.changeLocale(localeFromString(localeCode));
LocalizationProvider.of(context).state.onLocaleChanged();
}
}