schedule method
- @Deprecated('Deprecated due to problems with time zones. Use zonedSchedule instead.')
Schedules a notification to be shown at the specified date and time.
The androidAllowWhileIdle
parameter determines if the notification
should still be shown at the exact time when the device is in a low-power
idle mode.
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,
bool androidAllowWhileIdle = false,
}) async {
validateId(id);
final Map<String, Object?> serializedPlatformSpecifics =
notificationDetails?.toMap() ?? <String, Object>{};
serializedPlatformSpecifics['allowWhileIdle'] = androidAllowWhileIdle;
await _channel.invokeMethod('schedule', <String, Object?>{
'id': id,
'title': title,
'body': body,
'millisecondsSinceEpoch': scheduledDate.millisecondsSinceEpoch,
'platformSpecifics': serializedPlatformSpecifics,
'payload': payload ?? ''
});
}