Fixed Simple Problem, that occured after migrating to new version.

Still WIP need to fix more Problems
This commit is contained in:
2024-03-15 07:05:10 +01:00
parent c12ba48e15
commit 3085a295e5
36 changed files with 268 additions and 232 deletions

View File

@ -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 {

View File

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