I am new to flutter, I am trying to create an app that will send the user a notification and accept data from a database even if the app is closed. I have code to create a notification.
button that sends the notification, I want this to be done automatically while the app is closed
ElevatedButton(
onPressed: triggerNotification,
child: const Text('Trigger Notification'),
),
This is how the notification is created:
triggerNotification() {
AwesomeNotifications().createNotification(
content: NotificationContent(
id: 10,
channelKey: 'basic_channel',
//notification name
title: 'Notification name',
//notification content
body: 'Notification content',
),
);
}