return null if settings cant be correctly loaded
parent
21470da038
commit
9c4a5e0fbb
|
@ -1,7 +1,7 @@
|
|||
import 'package:smoke_cess_app/services/json_service.dart';
|
||||
|
||||
class Settings {
|
||||
final int? group;
|
||||
final int group;
|
||||
final List<String>? relapseCategories;
|
||||
final QueryConfig? moodQuery;
|
||||
final QueryConfig? sleepQuery;
|
||||
|
|
|
@ -66,7 +66,7 @@ void saveSettings(Settings settings) {
|
|||
}
|
||||
}
|
||||
|
||||
Future<Settings> loadSettings() async {
|
||||
Future<Settings?> loadSettings() async {
|
||||
int? group = await getGroup();
|
||||
List<String>? relapseCategories = await getRelapseCategories();
|
||||
int? moodHours = await getMoodQueryHours();
|
||||
|
@ -78,6 +78,7 @@ Future<Settings> loadSettings() async {
|
|||
int? chessHours = await getChessHours();
|
||||
int? chessMinutes = await getChessMinutes();
|
||||
|
||||
if (group != null) {
|
||||
return Settings(
|
||||
group,
|
||||
relapseCategories,
|
||||
|
@ -85,3 +86,5 @@ Future<Settings> loadSettings() async {
|
|||
QueryConfig(sleepHours, sleepMinutes, sleepDays),
|
||||
TimeConfig(chessHours, chessMinutes));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue