Flutter : How get Json data from firebase notification payload
Finally I'm able to solve this issue by my self
If you want get data from notification payload then you need to send your data inside "data"
-field of the message.
SAMPLE CODE read data from
"data"
-field of the message.
Future<void> _handleNotification( Map<dynamic, dynamic> message, bool dialog) async { var data = message['data'] ?? message; String notificationTitle = data['YOUR_KEY']; // here you need to replace YOUR_KEY with the actual key that you are sending in notification **`"data"`** -field of the message. String notificationMessage = data['YOUR_KEY'];// here you need to replace YOUR_KEY with the actual key that you are sending in notification **`"data"`** -field of the message. // now show the Dialog Utils().showMessageDialog(context, notificationTitle,notificationMessage); }
For more information please read Notification messages with additional data