can anyone help me to figure it out, I am trying to integrate Flutter Local Notification to my small project, Dynamically I am adding time and day not date, and want to repeat the notification on selected time and day weekly(Let's say I am selecting Saturday 10.30 PM and want to repeat the notification on every week same time & same day), it's not working, am I doing something wrong? earlier api of "flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime" was easy to undersatnd but it's deprecated. Note: "newDay " user selected day of a week, "time.hour & time.minute" is user selected time
await flutterLocalNotificationsPlugin.zonedSchedule(
0,
"Hurry! It's Working time!",
'Get Ready for Workout!',
_nextInstanceOfWeeklySchedule(),
// tz.TZDateTime.now(tz.local).add(diff),
const NotificationDetails(
android: AndroidNotificationDetails(
'weekly notification channel id',
'weekly notification channel name',
'weekly notificationdescription',
importance: Importance.max,
priority: Priority.max,
enableLights: true,
),
),
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
matchDateTimeComponents: DateTimeComponents.dayOfWeekAndTime);
}
tz.TZDateTime _nextInstanceOfWeeklySchedule() {
final tz.TZDateTime now = tz.TZDateTime.now(tz.local);
tz.TZDateTime scheduledDate = tz.TZDateTime(tz.local, now.year, now.month,
newDay, time.hour, time.minute - 5, now.second);
print(scheduledDate);
if (scheduledDate.isBefore(now)) {
scheduledDate = scheduledDate.add(const Duration(minutes: 1));
}
return scheduledDate;
}