diff --git a/lib/components/settings/timetable_data.dart b/lib/components/settings/timetable_data.dart index 8f14658..198752f 100644 --- a/lib/components/settings/timetable_data.dart +++ b/lib/components/settings/timetable_data.dart @@ -69,9 +69,10 @@ class TimetableDataOptions extends ConsumerWidget { return ShowAlertDialog( content: const Text("remove_all_subjects_dialog").tr(), approveButtonText: "delete".tr(), - onApprove: () { - subjNotifier.resetData(); - Navigator.of(context).pop(); + onApprove: () async { + await subjNotifier + .resetData() + .then((r) => Navigator.of(context).pop()); }, ); }, diff --git a/lib/provider/subjects.dart b/lib/provider/subjects.dart index 641b38f..a99c7a1 100644 --- a/lib/provider/subjects.dart +++ b/lib/provider/subjects.dart @@ -84,8 +84,8 @@ class SubjectNotifier extends StateNotifier> { /// deletes all subjects from db ([$SubjectTable]) and state /// /// also resets the overlapping subjects notifier. - void resetData() { - db.subject.delete(); + Future resetData() async { + await db.delete($SubjectTable(db)).go(); state = []; overlappingSubjectsNotifier.reset();