0

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',
      ),
    );
  }
pete more
  • 11
  • 3
  • Does this answer your question? [Flutter: Push notifications even if the app is closed](https://stackoverflow.com/questions/53572110/flutter-push-notifications-even-if-the-app-is-closed) – user18309290 Jun 22 '23 at 17:45

0 Answers0