I'm working in an app and I need to implement local notification based on user input. This means that the user will select when the app shows the notification. I found the method repeatInterval, but it only offers fixed time intervals such as
everyMinute → const RepeatInterval
hourly → const RepeatInterval
daily → const RepeatInterval
weekly → const RepeatInterval
I don't need these options, because they are fixed. I need to add a notification, and the interval on runtime.
I tried with,
NotificationDetails notificationDetails =
NotificationDetails(android: androidNotificationDetails);
await _flutterLocalNotificationsPlugin.zonedSchedule(
-1,
title,
body,
tz.TZDateTime.from(
DateTime.now().add(const Duration(hours: hours)),
tz.local
),
androidAllowWhileIdle: true,
notificationDetails,
uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime
);
With this method I was able to pass manually the first notification, but I need to repeat the notification X times until the user cancel the notification.
Any ideas?