According to https://firebase.flutter.dev/docs/messaging/usage/
onBackgroundMessage(…) is running on its own isolate.
How do I pass data from that isolate (which automatically spawns and runs a top level function) to the main app without using persistent storage (sqlite/files) which isn’t supported on the web platform?
Flutter Web does not support isolates. You are likely looking in the wrong documentation tab. Still, what you are looking for may just not be supported yet.
In order to share data between WebWorkers and the app, you can try using the awesome Drift library (formerly Moor).
You can offload the database to a background thread by using Web Workers. Drift also supports shared workers, which allows you to seamlessly synchronize query-streams and updates across multiple tabs!
You should be able to communicate with the background database web worker and save your data. If correctly setup, this will in turn update your frontend.
Maybe checkout this example: https://github.com/simolus3/moor/tree/develop/extras/web_worker_example
Answered By – kuhnroyal
Answer Checked By – Pedro (FlutterFixes Volunteer)