is a closed database safe for file copy? #1462
-
I want to do something like this: final db = Provider.of<Database>(context, listen: false);
await db.close();
await _copyDatabaseFileToBackupFile();
await _uploadBackupFile();
_deleteBackupFile();
From what else I've seen, I infer this is OK as long as Also, is it possible to re-open the database easily once it's closed (like, after all the other operations are complete)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, this should be fine. Be aware that other operations using the database will throw an exception once the database has been closed, so you might need some in-app synchronization to avoid that.
Not really unfortunately, you'd have to create a new instance of the database class and use that then. |
Beta Was this translation helpful? Give feedback.
Yes, this should be fine. Be aware that other operations using the database will throw an exception once the database has been closed, so you might need some in-app synchronization to avoid that.
Not really unfortunately, you'd have to create a new instance of the database class and use that then.