flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

false positive when using `didNotificationLaunchApp` when performing a hot restart after showing scheduled notif

Open imedboumalek opened this issue 2 years ago • 0 comments

Describe the bug When creating a scheduled notif with a payload, showing that notification, then doing a hot restart, the handler for notification tapped gets executed because didNotificationLaunchAppis true my code:

class _HomeScreenState extends State<HomeScreen> {
 @override
 void initState() {
   super.initState();
   final notifPlugin = locator<FlutterLocalNotificationsPlugin>();
   notifPlugin.getNotificationAppLaunchDetails().then((value) {
     if (value?.didNotificationLaunchApp ?? false) {
       notificationTapped(value?.payload);
     }
   });
 }

To Reproduce Tested on Android with scheduled notifications

  1. create a notification for 10s from now
  2. show notification (but don't tap it, you could even delete it and it'll still happen)
  3. hot restart
  4. See error

imedboumalek avatar Sep 15 '22 12:09 imedboumalek