zonedSchedule method

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

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

Implementation

@override
Future<void> zonedSchedule({
  required int id,
  String? title,
  String? body,
  required tz.TZDateTime scheduledDate,
  String? payload,
  DateTimeComponents? matchDateTimeComponents,
  DarwinNotificationDetails? notificationDetails,
}) 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,
              },
      ),
  );
}