You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, thank you for your great packages. I've been using your Sembast for years and it has been rock solid and it's so easy to use. I am now looking to Sqlflite, as I thought you could use it to access a Sqlite database in the background, but I am unsure.
On the usage recommendation page and within some issues, it says that access should only occur in the main Isolate; however, on the changelog, v2.2.0+3 says initial support of cross Isolate safe.
Please could you clarify if accessing a database from both the main Isolate, and a background Isolate (e.g. for writing records during a scheduled task) is possible and/or recommended.
Apologies if I this is mentioned in a change or readme and I've missed it.
The text was updated successfully, but these errors were encountered:
amugofjava
changed the title
Accessing database from a background Isolate rather than main Isolate
Accessing database from a background Isolate & main Isolate
Jul 19, 2024
Indeed many people have asked about access from another isolate and unfortunately I don't have a good answer for that and the documentation is unclear about that, sorry.
It should work although I have not tested it much and I have avoided it (for example by saving the temporary data read
in a file that I handle later in the main isolate). One common usage
on Android and iOS is to have access from a push notification isolate or scheduled task.
Good if you can avoid it and only limit to this case (background notification / scheduled task)
In both isolates
Use singleInstance: false in openDatabase
Don't close the database
Since hot reload might fail when using singleInstance: false (if done while a transaction is in progress), you
can try singleInstance: true in the main isolate only.
Hi,
Firstly, thank you for your great packages. I've been using your Sembast for years and it has been rock solid and it's so easy to use. I am now looking to Sqlflite, as I thought you could use it to access a Sqlite database in the background, but I am unsure.
On the usage recommendation page and within some issues, it says that access should only occur in the main Isolate; however, on the changelog, v2.2.0+3 says initial support of cross Isolate safe.
Please could you clarify if accessing a database from both the main Isolate, and a background Isolate (e.g. for writing records during a scheduled task) is possible and/or recommended.
Apologies if I this is mentioned in a change or readme and I've missed it.
The text was updated successfully, but these errors were encountered: