Skip to main content

fetchLocale method

Future<void> fetchLocale ()

This function fetch the language of the user's app.

Implementation

Future<void> fetchLocale() async {
final prefs = await SharedPreferences.getInstance();
final String langCode = prefs.getString('language_code') ?? 'en';
_appLocale = Locale(langCode);

notifyListeners();
}