I'm making a Flutter app that includes in-app messaging, and I'm managing my push notifications with Firebase.
I also have non-message notifications that are sent via Firebase too.
I need a different look for message notifications (MessagingStyleInformation), so I handle them in background and terminated state by not sending Notification part in a RemoteMessage from backend, and then using a global function in my app to handle showing appropriate notification style. But there is a problem, now when I click on the push notification for chat and my app is in terminated state, it cannot redirect to a chat screen because FirebaseMessaging.instance.getInitialMessage() returns null.

This is the code in my home screen:

It works fine with my non-chat push notifications (getInitialMessage will return an actual RemoteMessage that came, because it contains Notification part) , but as I mentioned before, it doesn't work with message push notifications.
Can this condition for Notification part be removed, so that Firebase Messaging plugin can remember all remote messages that came?
I'm making a Flutter app that includes in-app messaging, and I'm managing my push notifications with Firebase.
I also have non-message notifications that are sent via Firebase too.
I need a different look for message notifications (MessagingStyleInformation), so I handle them in background and terminated state by not sending Notification part in a RemoteMessage from backend, and then using a global function in my app to handle showing appropriate notification style. But there is a problem, now when I click on the push notification for chat and my app is in terminated state, it cannot redirect to a chat screen because FirebaseMessaging.instance.getInitialMessage() returns null.

This is the code in my home screen:

It works fine with my non-chat push notifications (getInitialMessage will return an actual RemoteMessage that came, because it contains Notification part) , but as I mentioned before, it doesn't work with message push notifications.
Can this condition for Notification part be removed, so that Firebase Messaging plugin can remember all remote messages that came?