functional datastructure. Needs to be able to write to storage as well
This commit is contained in:
@@ -67,16 +67,16 @@ class UserPreferences {
|
||||
|
||||
|
||||
void save() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
SharedPreferences sharedPrefs = await SharedPreferences.getInstance();
|
||||
for (SinglePreference pref in preferences) {
|
||||
prefs.setInt(pref.key, pref.value);
|
||||
sharedPrefs.setInt(pref.key, pref.value);
|
||||
}
|
||||
}
|
||||
|
||||
void load() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
SharedPreferences sharedPrefs = await SharedPreferences.getInstance();
|
||||
for (SinglePreference pref in preferences) {
|
||||
pref.value = prefs.getInt(pref.key) ?? 0;
|
||||
pref.value = sharedPrefs.getInt(pref.key) ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user