From 2c9a001f1c852fd2f902bae6af379a3f5317fd69 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 11 Jan 2024 21:14:41 +0100 Subject: [PATCH] Save the database to the application cache folder The documents folder is suggested for files that can't be generated by the application itself --- lib/database/exercises/exercise_database.dart | 2 +- lib/database/ingredients/ingredients_database.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/database/exercises/exercise_database.dart b/lib/database/exercises/exercise_database.dart index 64082ff3..b68d1980 100644 --- a/lib/database/exercises/exercise_database.dart +++ b/lib/database/exercises/exercise_database.dart @@ -78,7 +78,7 @@ class ExerciseDatabase extends _$ExerciseDatabase { LazyDatabase _openConnection() { return LazyDatabase(() async { - final dbFolder = await getApplicationDocumentsDirectory(); + final dbFolder = await getApplicationCacheDirectory(); final file = File(p.join(dbFolder.path, 'exercises.sqlite')); return NativeDatabase.createInBackground(file); }); diff --git a/lib/database/ingredients/ingredients_database.dart b/lib/database/ingredients/ingredients_database.dart index 12e97cd0..8b0ae593 100644 --- a/lib/database/ingredients/ingredients_database.dart +++ b/lib/database/ingredients/ingredients_database.dart @@ -30,7 +30,7 @@ class IngredientDatabase extends _$IngredientDatabase { LazyDatabase _openConnection() { return LazyDatabase(() async { - final dbFolder = await getApplicationDocumentsDirectory(); + final dbFolder = await getApplicationCacheDirectory(); final file = File(p.join(dbFolder.path, 'ingredients.sqlite')); return NativeDatabase.createInBackground(file); });