tekartik / sembast.dart

Simple io database
BSD 2-Clause "Simplified" License
780 stars 64 forks source link

Data saved in sembast from firebase background notification handler is not shown #288

Closed bilalgodesto closed 2 years ago

bilalgodesto commented 2 years ago

I am saving some notification data when i receive the notification i added them to sembast database. I can verify that the data is saved successfully. But when i try to read that data by opening the application i am not able to see that particular data. Do i have reopen the database if data is saved from background notification. This is happening in android only. IOS is working fine

alextekartik commented 2 years ago

sembast is not cross isolate safe so I would not recommend using it from a background notification. I'm not aware of any good solution for this scenario. Typically when you receive a notification when the app is running you are in the main isolate so that should be fine. If you encounter another scenario (which I guess i always avoided), you should use a cross isolate safe mechanism (such as a simple file) for this temp scenario and reconcile the data when the app is launched.