setLastSelectedLocale method
Implementation
Future<void> setLastSelectedLocale(String? locale) async {
final normalized = locale?.trim();
final next = (normalized == null || normalized.isEmpty) ? null : normalized;
if (_lastSelectedLocale == next) {
return;
}
_lastSelectedLocale = next;
notifyListeners();
final storage = await DefaultKeyValueStorage.getInstance();
if (next == null) {
await storage.remove(_catalogLastSelectedLocaleStorageKey);
} else {
await storage.setString(_catalogLastSelectedLocaleStorageKey, next);
}
}