Any other alternative to notify events in flutter?
I have a dart class A that needs to notify some event to the class B which instantiated it. I have this code in class B: MqttComm().oMessageReceived.listen((message) { // code that acts according to the received event }); On the other hand, class A has this definition: final _messageController = StreamController<ReceivedMqttMessage>.broadcast(); Stream<ReceivedMqttMessage> get oMessageReceived => _messageController.stream; Where ReceivedMqttMessage is this: class ReceivedMqttMessage { final String topic; final String payload; ReceivedMqttMessage(this.topic, this.payload); } Finally, class A no
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.