zonedSchedule method

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

Schedules a notification to be shown at the specified date and time relative to a specific time zone.

Implementation

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