setLocale method

Future<void> setLocale(
  1. Locale locale
)

Implementation

Future<void> setLocale(Locale locale) async {
  if (_locale == locale) return;
  _locale = locale;
  notifyListeners();
  final prefs = await SharedPreferences.getInstance();
  await prefs.setString(_key, locale.languageCode);
}