Skip to content

Commit

Permalink
fix delete all subjects button not working
Browse files Browse the repository at this point in the history
  • Loading branch information
user5522 committed Jun 8, 2024
1 parent 5b81c5a commit 9d26719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/components/settings/timetable_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
},
);
},
Expand Down
4 changes: 2 additions & 2 deletions lib/provider/subjects.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class SubjectNotifier extends StateNotifier<List<SubjectData>> {
/// deletes all subjects from db ([$SubjectTable]) and state
///
/// also resets the overlapping subjects notifier.
void resetData() {
db.subject.delete();
Future<void> resetData() async {
await db.delete($SubjectTable(db)).go();
state = [];

overlappingSubjectsNotifier.reset();
Expand Down

0 comments on commit 9d26719

Please sign in to comment.