I had a flutter app with a chat room feature. Firebase messaging is used to push remote notification. I want to hide the notification popup if the app is at foreground and it happens to be at the exact chat room where that coming notification belongs to.
This is a common behavior when you're chatting with someone. The message appends to chat room directly instead of popup.
My question is how to interfere the remote notification on receiving? I used onMessage callback on notification received event. But it always popups no matter the app is at foreground or background or termiated.
In firebase React Native version, it has an onNotification callback which does exactly what I want. But there is no equivalence for flutter. My research leads me to send Data and Notification type of message. In such a way, I need to keep app status synchronized with my backend server (Am I right?).
Any help or suggestion is welcome. Thank you.
P.S. firebase_messaging 8.0.0-dev.10