Fixed Simple Problem, that occured after migrating to new version.
Still WIP need to fix more Problems
This commit is contained in:
@ -11,15 +11,16 @@ class AppSettingsRepository {
|
||||
AppSettingsRepository(this.prefs, {this.codec = json});
|
||||
|
||||
Future<AppSettingsEntity> loadAppSettings() {
|
||||
final String jsonString = this.prefs.getString(_key);
|
||||
if (jsonString == null)
|
||||
final String? jsonString = prefs.getString(_key);
|
||||
if (jsonString == null) {
|
||||
return Future<AppSettingsEntity>.value(AppSettingsEntity.defaults());
|
||||
}
|
||||
return Future<AppSettingsEntity>.value(
|
||||
AppSettingsEntity.fromJson(codec.decode(jsonString)));
|
||||
}
|
||||
|
||||
Future<bool> saveAppSettings(AppSettingsEntity appSettings) =>
|
||||
this.prefs.setString(_key, codec.encode(appSettings));
|
||||
prefs.setString(_key, codec.encode(appSettings));
|
||||
}
|
||||
|
||||
class AppSettingsEntity {
|
||||
|
@ -10,7 +10,7 @@ class TimeProgressRepository {
|
||||
TimeProgressRepository(this.prefs, {this.codec = json});
|
||||
|
||||
Future<List<TimeProgressEntity>> loadTimeProgressList() {
|
||||
final String jsonString = this.prefs.getString(_key);
|
||||
final String? jsonString = prefs.getString(_key);
|
||||
if (jsonString == null) {
|
||||
return Future<List<TimeProgressEntity>>.value([]);
|
||||
}
|
||||
@ -24,6 +24,6 @@ class TimeProgressRepository {
|
||||
Future<bool> saveTimeProgressList(List<TimeProgressEntity> timeProgressList) {
|
||||
final String jsonString = codec.encode(
|
||||
{"timers": timeProgressList.map((timer) => timer.toJson()).toList()});
|
||||
return this.prefs.setString(_key, jsonString);
|
||||
return prefs.setString(_key, jsonString);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user