My question is simply,
- I have integrated OneSignal Flutter plugin version 5.1.2 in my Flutter app.
- I have read from the docs that I can get the notification data whenever a user clicks on the notification while the app is opened using this code:
void _setNotificationClickListener() {
OneSignal.Notifications.addClickListener((OSNotificationClickEvent event) {
log('Notification clicked');
print('NOTIFICATION CLICK LISTENER CALLED WITH EVENT: ${event.jsonRepresentation()}');
});
}
- I want to implement deeplinks into my app, for example:
Whenever the user clicks on the notification while the app was closed, the app should open up and load the corresponding article for which the notification was sent - In this scenario I have the code ready for:
a. I have a global router which can load the correct article
b. I’m already sending additional data in the notification from onesignal in my backend
My only problem is how do I get the additional data in code when the app was freshly opened via the notification?