How to implement a general application message queue in Flutter?

  Kiến thức lập trình

When I set a queue instance as closed (e.g. from a timer) and I have active items in that queue, I want to send a message that something will pop up in the UI confirming that the user wants to mark all the active items as cancelled

This one-way pipeline would receive from any piece of code and have some sort of consumer that could put up AlertDialogs, for example, and execute callbacks contained in the message


You could do that by creating your own MessageQueue Object with a property of either a Stream<YourEventClass> or a ValueNotifier. Also add a queueEvent(YourEventClass event) function.
Then make this Object accessible by e.g. registering it as Singleton in get_it and observe the Stream/ValueNotfier in the where you need to react on this.