I am using flutter_local_notifications and timezone to create schedule notification.
My question is how can I set schedule notification as per given timezone.
For exp, I am in India and I want to set timezone as per pakistan/karachi, now whenever I select time as per karachi timezone then I am facing error Invalid argument (scheduledDate): Must be a date in the future
How can I schedule notification as per given timezone to local timezone?
here is my code sample.
tz.initializeTimeZones();
var karachiTime = tz.getLocation('Asia/Karachi');
tz.setLocalLocation(karachiTime);
try {
await flutterLocalNotificationsPlugin!.zonedSchedule(1, 'Reminder', "Reminder",
tz.TZDateTime.from(tzDateTime, karachiTime), NotificationService.scheduleNotificationDetails,
androidAllowWhileIdle: true,
payload: tempPayload,
uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime);
print("Next Schedule: " + tzDateTime.toString());
} catch (e) {
print("Schedule Error: " + e.toString());
}
Thanks in Advance!