I'm facing an issue with displaying double notifications when the app in the background firebase handle the notification first and then the flutter local notification display a popup on the screen anyway to make firebase not show the notification
p.s remove the
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
make the app not handle notifications on background
FirebaseMessaging.onMessage.listen(
(RemoteMessage? message) async {
_showNotification(
id: 0,
title: message?.notification?.title ?? '',
body: message?.notification?.body ?? '');
},
);
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
firebaseMessagingBackgroundHandler:
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage? message) async {
_showNotification(
id: 0,
title: message?.notification?.title ?? '',
body: message?.notification?.body ?? '');
}
the firebase package contains title and body in the notification flag even if the app working in the background any way to make the notification only handled by flutter_local_notification package