Skip to content

Commit accc46e

Browse files
committed
bug fix: check if db file exists before removing it
1 parent 4b6e69f commit accc46e

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/repository/base_repository.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ class BaseRepository {
1515

1616
Future<void> dropDatabase() async {
1717
final databasePath = await _getDatabasePath();
18+
final fileType = await FileSystemEntity.type(databasePath);
19+
20+
if (fileType == FileSystemEntityType.notFound) {
21+
return;
22+
}
23+
1824
final file = File(databasePath);
1925

2026
await file.delete();

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: A new Flutter application.
1111
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1212
# Read more about iOS versioning at
1313
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
14-
version: 1.4.0+10
14+
version: 1.4.1+10
1515

1616
environment:
1717
sdk: ">=2.2.0 <3.0.0"

0 commit comments

Comments
 (0)