setLocale static method

Future<bool> setLocale(
  1. Locale locale
)

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);
}