Flutter zoned notification not working with different ids

21 Views Asked by At

I'am making an app with zoned notification and I noticed error that I don't understand.

When I use

  Future<void> showNotiificationAt(int id, DateTime time ) async {
        notificationsPlugin.zonedSchedule(
        id,
        "Title",
        "Description",
        tz.TZDateTime.from(time, tz.local),
        await notificationDetails(),
        uiLocalNotificationDateInterpretation:
            UILocalNotificationDateInterpretation.absoluteTime,
            androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle);
  }


 notificationDetails() {
    return const NotificationDetails(
        android: AndroidNotificationDetails('channelId', 'channelName',
            importance: Importance.high),
        iOS: DarwinNotificationDetails());
  }

It does not work.

This can be solved by using 0 instead of the id, but then I can do only one notification.

Point is that zoned notification works only when I make one with id 0.

I tried making the id zero every time, which resulted in the notification working, but then the app can have only one notification.

0

There are 0 best solutions below