zonedSchedule method Null safety

Future<void> zonedSchedule(
  1. int id,
  2. String? title,
  3. String? body,
  4. TZDateTime scheduledDate,
  5. AndroidNotificationDetails? notificationDetails,
  6. {required bool androidAllowWhileIdle,
  7. String? payload,
  8. 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,
  AndroidNotificationDetails? notificationDetails, {
  required bool androidAllowWhileIdle,
  String? payload,
  DateTimeComponents? matchDateTimeComponents,
}) async {
  validateId(id);
  validateDateIsInTheFuture(scheduledDate, matchDateTimeComponents);
  ArgumentError.checkNotNull(androidAllowWhileIdle, 'androidAllowWhileIdle');
  final Map<String, Object?> serializedPlatformSpecifics =
      notificationDetails?.toMap() ?? <String, Object>{};
  serializedPlatformSpecifics['allowWhileIdle'] = androidAllowWhileIdle;
  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
              }));
}