Skip to content

Question/Request - Communication need between background isolate of action and main isolate #2517

Closed
@mmmeeedddsss

Description

@mmmeeedddsss

Describe the request
I have a use case for background notification actions, which triggers some changes in the data store of the application. The action itself should be a background action, since I don't want it to open the UI if the application is closed.

The issue is, if the application is running, and user picks these actions while the application is on the foreground, the UI of my application cannot get refreshed since the main isolate cannot know if the data store is changed or not.

As far as I could read, the recommended approach is to pass SendPort to the created isolate but the onDidReceiveBackgroundNotificationResponse method doesn't allow for such a change.

My question is, if it is possible to create a communication link between background isolate that is triggered by a notification action and the main isolate, if it exists.

If it is not something possible, please consder my message and use case as a feature request for users of the app to be able to create such communication channels.

To Reproduce

  1. Have an application storing state in a persistent store, and showing that information on UI
  2. Register a notification with a background action. This action triggers the state in the persistent store to change.
  3. While the app is open, trigger the action of your notification and observe that the state in the persistent store changes while the UI stays the same since the application hasn't been notified about the change in the persistent store(sinceaction and main isolates are seperate, there is no way visible to me to notify the main isolate as of now)

Expected behavior

  • If it is possible to create a communication channel between background isolate and main isolate, the documentation to explain how.
  • Making it possible to create of such a communication channel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions