Although all the other functions work perfectly, I receive the message and display it in all conditions, in the background, foreground or initial message.

in the background:

```
Future<void> backgroundHandler(RemoteMessage message) async {
  print(message.data.toString());
  print(message.notification!.title);
}

FirebaseMessaging.onBackgroundMessage(backgroundHandler);

```

in the foreground:

```
FirebaseMessaging.onMessage.listen((message) {
      if (message.notification != null) {
        add(NotificationRecieved(message));
      }
    });

```

in the initialization of the application:

```
await FirebaseMessaging.instance.getInitialMessage().then((message) {
      if (message != null) {
        LocalNotificationService.display(message);
        return message.data["route"];
      }
    });

```

but this doesn't work: when I click on the notification

```
FirebaseMessaging.onMessageOpenedApp.listen(
      (message) {
        toast(message.data.toString());
        var route = message.data["route"];
        Navigator.pushNamed(context, route);
      },
    );

```

the function (onMessageOpenedApp.listen) itself isn't being called.