schedule method

  1. @Deprecated('Deprecated due to problems with time zones. Use zonedSchedule instead.')
Future<void> schedule(
  1. int id,
  2. String? title,
  3. String? body,
  4. DateTime scheduledDate,
  5. AndroidNotificationDetails? notificationDetails, {
  6. String? payload,
  7. AndroidScheduleMode scheduleMode = AndroidScheduleMode.exact,
})

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

The scheduleMode parameter defines the precision of the timing for the notification to be appear.

Implementation

@Deprecated(
    'Deprecated due to problems with time zones. Use zonedSchedule instead.')
Future<void> schedule(
  int id,
  String? title,
  String? body,
  DateTime scheduledDate,
  AndroidNotificationDetails? notificationDetails, {
  String? payload,
  AndroidScheduleMode scheduleMode = AndroidScheduleMode.exact,
}) async {
  validateId(id);
  await _channel.invokeMethod('schedule', <String, Object?>{
    'id': id,
    'title': title,
    'body': body,
    'millisecondsSinceEpoch': scheduledDate.millisecondsSinceEpoch,
    'platformSpecifics':
        _buildPlatformSpecifics(notificationDetails, scheduleMode),
    'payload': payload ?? ''
  });
}