zonedSchedule static method
Implementation
static Future<void> zonedSchedule(LocalNotificationModel model) async {
if (model.date == null) {
throw Exception("date must provide d to schedule notification");
}
final DateTime scheduleDate = DateTime(
model.date!.year,
model.date!.month,
model.date!.day,
model.date!.hour,
model.date!.minute,
);
if (scheduleDate.isBefore(DateTime.now())) {
throw Exception("date must be in future");
}
await handleTimeZone();
final NotificationDetails notificationDetails =
await NotifiyDetailsCreator.createNotifyDetails(model);
final TZDateTime scheduledDate = getScheduleDate(model);
await FlutterLocalNotificationsPlugin().zonedSchedule(
model.id,
model.title,
model.body,
scheduledDate,
notificationDetails,
androidScheduleMode: AndroidScheduleMode.exact,
payload: model.payload,
);
}