1
0
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:
Tushar Ojha
2021-01-31 12:27:40 +05:30
committed by GitHub
parent f63c465ff4
commit 1fae13ef3a
3 changed files with 53 additions and 2 deletions

View File

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