saveLocale method

Future<bool> saveLocale([
  1. Locale? locale
])

Save a locale to the app's locale

Implementation

Future<bool> saveLocale([Locale? locale]) async {
  final saved = allowChangeLocale && locale != null;
  //Saved only if first called to look up.
  if (saved) {
    appState?.locale = locale; // Ensure AppState gets updated
    await Prefs.setString('locale', locale.toLanguageTag());
  }
  return saved;
}