mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 23:08:59 +00:00
[VeggieSeasons] added restore defaults feature (#639)
This commit is contained in:
@@ -50,6 +50,12 @@ class Preferences extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> restoreDefaults() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
load();
|
||||
}
|
||||
|
||||
void load() {
|
||||
_loading = _loadFromSharedPrefs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user