changeAppLanguage method

Future<void> changeAppLanguage(
  1. BuildContext context,
  2. Locale locale
)

Implementation

Future<void> changeAppLanguage(BuildContext context, Locale locale) async {
  if (await selectedLocale != locale) {
    await context.setLocale(locale);
    await SharePreferenceService.setValue(
        SharePreferenceKey.selectedLanguage, locale.toString());
  }
}