Is it possible to enable the client listening only when publish a message?

I implemented mqtt.But I have some queries. Client is started to be listening once connection is done.
_client.updates!.listen((List<MqttReceivedMessage<MqttMessage?>>? c) {}
So, is it possible to enable the listener only when publish a message Instead of listening every time?I think it takes some memory.so any way to handle like that?

Hi @Resma ,

Thank you for reaching out with your MQTT query. It’s great to hear that you’ve successfully implemented an MQTT client!

Could you please provide some more details about the specific MQTT library you’re using and the context of your implementation? Sharing your code and explaining its purpose would help better understand your scenario and provide you with more targeted advice.

What makes you conclude that when a client is listening to incoming messages, it is consuming more memory, could you please elaborate more on that? Interested to know more about your testing methodology and observations that led you to this conclusion.

Feel free to share more information, and I’ll do my best to provide you with valuable insights and suggestions. Looking forward to assisting you further!

Best regards,
Dasha From HiveMQ TEAM