setLocale static method
Saving locale to SharedPreferences
so that we can use it in background
Implementation
static Future<bool> setLocale(Locale locale) async {
var prefs = await SharedPreferences.getInstance();
return await prefs.setString(_localeKey, locale.languageCode);
}