Skip to content

Commit 2c9a001

Browse files
committed
Save the database to the application cache folder
The documents folder is suggested for files that can't be generated by the application itself
1 parent 802da6a commit 2c9a001

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/database/exercises/exercise_database.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ExerciseDatabase extends _$ExerciseDatabase {
7878

7979
LazyDatabase _openConnection() {
8080
return LazyDatabase(() async {
81-
final dbFolder = await getApplicationDocumentsDirectory();
81+
final dbFolder = await getApplicationCacheDirectory();
8282
final file = File(p.join(dbFolder.path, 'exercises.sqlite'));
8383
return NativeDatabase.createInBackground(file);
8484
});

lib/database/ingredients/ingredients_database.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class IngredientDatabase extends _$IngredientDatabase {
3030

3131
LazyDatabase _openConnection() {
3232
return LazyDatabase(() async {
33-
final dbFolder = await getApplicationDocumentsDirectory();
33+
final dbFolder = await getApplicationCacheDirectory();
3434
final file = File(p.join(dbFolder.path, 'ingredients.sqlite'));
3535
return NativeDatabase.createInBackground(file);
3636
});

0 commit comments

Comments
 (0)