Skip to content

Commit c0708bb

Browse files
authored
Merge pull request #18 from arran4/codex/change-deleteproject-to-async
Make delete flow await database deletion
2 parents f50d356 + 30b8a32 commit c0708bb

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/database.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DB {
7272
return project;
7373
}
7474

75-
void deleteEntireDatabase() async {
75+
Future<void> deleteEntireDatabase() async {
7676
String fn = await filepath();
7777
Database db = await _db;
7878
await db.close();

lib/settings.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ class DeleteDatabaseScreen extends StatelessWidget {
8080
child: const Text("Don't Delete"),
8181
),
8282
ElevatedButton(
83-
onPressed: () => deleteProject(context),
83+
onPressed: () async {
84+
await deleteProject(context);
85+
},
8486
style: ButtonStyle(
8587
backgroundColor: MaterialStateProperty.resolveWith((states) => Colors.red),
8688
),
@@ -99,8 +101,8 @@ class DeleteDatabaseScreen extends StatelessWidget {
99101
Navigator.of(context).pop();
100102
}
101103

102-
void deleteProject(BuildContext context) async {
103-
db.deleteEntireDatabase();
104+
Future<void> deleteProject(BuildContext context) async {
105+
await db.deleteEntireDatabase();
104106
if (context.mounted) {
105107
Navigator.of(context).pop();
106108
}

0 commit comments

Comments
 (0)