setLocale method

Future<void> setLocale(
  1. Locale? locale
)

Persists the chosen language, or clears it (follow-system) when locale is null.

Implementation

Future<void> setLocale(Locale? locale) async {
  final p = await _prefs();
  if (locale == null) {
    await p.remove(_localeKey);
  } else {
    await p.setString(_localeKey, locale.languageCode);
  }
}