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 even 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,
NotificationDetails notificationDetails, {
String? payload,
bool androidAllowWhileIdle = false,
}) async {
if (kIsWeb) {
return;
}
if (defaultTargetPlatform == TargetPlatform.android) {
await resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()!.schedule(
id, title, body, scheduledDate, notificationDetails.android,
payload: payload, androidAllowWhileIdle: androidAllowWhileIdle);
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
await resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()
?.schedule(id, title, body, scheduledDate, notificationDetails.iOS, payload: payload);
} else if (defaultTargetPlatform == TargetPlatform.macOS) {
throw UnimplementedError();
}
}