diff --git a/lib/database.dart b/lib/database.dart index 82a2f04..13ee40d 100644 --- a/lib/database.dart +++ b/lib/database.dart @@ -72,7 +72,7 @@ class DB { return project; } - void deleteEntireDatabase() async { + Future deleteEntireDatabase() async { String fn = await filepath(); Database db = await _db; await db.close(); diff --git a/lib/settings.dart b/lib/settings.dart index 89eba31..11c06c8 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -76,7 +76,9 @@ class DeleteDatabaseScreen extends StatelessWidget { child: const Text("Don't Delete"), ), ElevatedButton( - onPressed: () => deleteProject(context), + onPressed: () async { + await deleteProject(context); + }, style: ButtonStyle( backgroundColor: MaterialStateProperty.resolveWith((states) => Colors.red), ), @@ -95,8 +97,8 @@ class DeleteDatabaseScreen extends StatelessWidget { Navigator.of(context).pop(); } - void deleteProject(BuildContext context) async { - db.deleteEntireDatabase(); + Future deleteProject(BuildContext context) async { + await db.deleteEntireDatabase(); if (context.mounted) { Navigator.of(context).pop(); }