This is how I am creating a notification using Awesome Notifications in flutter
AwesomeNotifications().createNotification(
content: NotificationContent(
id: 1,
channelKey: 'basic_channel',
title: "You spent some money?",
body:
"We think, ₹ ${jsonObject['amount']} that was ${jsonObject['type']} to ${jsonObject['vendor']} belongs to this category: ${jsonObject['category']}",
actionType: ActionType.Default),
actionButtons: [
NotificationActionButton(
key: 'Approve',
label: 'Approve',
),
NotificationActionButton(
key: 'Edit',
label: 'Edit',
)
],
);
I want to add different functionalities to Approve and Edit options. What is the exact syntax to do that?
2
Answers
This is a example of Downloading a PDF file and showing a notification to PDF Downloaded successfully and give option to open it
So, Ive Passed Payload to Notification
In your case You have to give a Channle Key and You have to create a funtion for your specific functionality and replace in place of
enter code here
dir.pathI hope it will work.
Since you have the keys you can use this
You will then need to create these 2 functions with your desired functionalities, if the functionalities are very similar you could create only 1 function and send the
receivedAction.buttonKey
as a parameter.