How to send push notification in flutter, so that it will not stay in system tray? Or delete it from system tray after showing up

Viewed 240

The app is in the foreground. I am showing a local notification to the user. After showing up, I don't want the user to see this notification in the system tray. Can this package or other allow me to send notification without entering to the system tray, or delete this notification just after showing up.

1 Answers

The flutter_local_notifications plugin provides a method to cancel all notifications or cancel a single notification. You have to call them in the appropriate place for it to work

await flutterLocalNotificationsPlugin.cancelAll(); \\ Removes all Notifications

await flutterLocalNotificationsPlugin.cancel(1); \\ Removes notification with id = 1

If this does not work, you can also try this plugin https://pub.dev/packages/eraser

Related