zonedSchedule method

Future<void> zonedSchedule(
  1. int id,
  2. String? title,
  3. String? body,
  4. TZDateTime scheduledDate,
  5. DarwinNotificationDetails? notificationDetails,
  6. {required UILocalNotificationDateInterpretation uiLocalNotificationDateInterpretation,
  7. String? payload,
  8. DateTimeComponents? matchDateTimeComponents}

Schedules a notification to be shown at the specified time in the future in a specific time zone.

Due to the limited support for time zones provided the UILocalNotification APIs used on devices using iOS versions older than 10, the uiLocalNotificationDateInterpretation is needed to control how scheduledDate is interpreted. See official docs at for more details. Note that due to this limited support, it's likely that on older iOS devices, there will still be issues with daylight saving time except for when the time zone used in the scheduledDate matches the device's time zone and uiLocalNotificationDateInterpretation is set to UILocalNotificationDateInterpretation.wallClockTime.


Future<void> zonedSchedule(
  int id,
  String? title,
  String? body,
  TZDateTime scheduledDate,
  DarwinNotificationDetails? notificationDetails, {
  required UILocalNotificationDateInterpretation
  String? payload,
  DateTimeComponents? matchDateTimeComponents,
}) async {
  validateDateIsInTheFuture(scheduledDate, matchDateTimeComponents);
  final Map<String, Object?> serializedPlatformSpecifics =
      notificationDetails?.toMap() ?? <String, Object>{};
  await _channel.invokeMethod(
      <String, Object?>{
        'id': id,
        'title': title,
        'body': body,
        'platformSpecifics': serializedPlatformSpecifics,
        'payload': payload ?? '',
        ..addAll(matchDateTimeComponents == null
            ? <String, Object>{}
            : <String, Object>{
                'matchDateTimeComponents': matchDateTimeComponents.index