I have an app created by Flutter, gorouter, Riverpod and Firebase.
I send a notification with FCM and when user taps on the notification, it opens the app, go to a page and then push another page on top of it.
It works as expected when the app is running in background.
But when the app is closed, sometimes it works and sometimes does not. Sometimes it says that the page not found and another time it opens the second page but back button does not work. It seems that the pushed page becomes the first page in the stack.
here is my code:
final messagingProvider = Provider<FirebaseMessaging>((ref) {
return FirebaseMessaging.instance;
});
ref
.read(messagingProvider)
.getInitialMessage()
.then((RemoteMessage? message) {
ref.read(goRouterProvider).goNamed(RouteNames.reviews.name);
ref.read(goRouterProvider).pushNamed(RouteNames.reviewDetail.name, extra: message);
}