I am trying to achieve open specific screen on clicking push notification and my payload looks like this:
var payload = {
notification: {
A few things here:
1- click_action has to be set to "FLUTTER_NOTIFICATION_CLICK"
2- click_action has to be set in the data section of a payload
DATA='{
"notification": {
"body": "this is a body",
"title": "this is a title"
"click_action": "FLUTTER_NOTIFICATION_CLICK",
},
"data": {
"sound": "default",
"status": "done",
"screen": "screenA",
},
"to": ""
}'
This should allow you to receive the message in the onMessage handler in your flutter app.
From there you can call Navigator.of(context).pushNamed(message['screen']).
If you don't have a BuildContext at that point, you can register a GlobalKey as the navigatorKey property of your MaterialApp, and use it to access your Navigator globally, via GlobalKey.currentState