zonedSchedule method
Future<void>
zonedSchedule(
- int id,
- String? title,
- String? body,
- TZDateTime scheduledDate,
- AndroidNotificationDetails? notificationDetails, {
- required AndroidScheduleMode scheduleMode,
- String? payload,
- DateTimeComponents? matchDateTimeComponents,
Schedules a notification to be shown at the specified date and time relative to a specific time zone.
The scheduleMode
parameter defines the precision of the timing for the
notification to be appear.
This will also require additional setup for the app, especially in the
app's AndroidManifest.xml
file. Please see check the readme for further
details.
Implementation
Future<void> zonedSchedule(
int id,
String? title,
String? body,
TZDateTime scheduledDate,
AndroidNotificationDetails? notificationDetails, {
required AndroidScheduleMode scheduleMode,
String? payload,
DateTimeComponents? matchDateTimeComponents,
}) async {
validateId(id);
validateDateIsInTheFuture(scheduledDate, matchDateTimeComponents);
await _channel.invokeMethod(
'zonedSchedule',
<String, Object?>{
'id': id,
'title': title,
'body': body,
'platformSpecifics':
_buildPlatformSpecifics(notificationDetails, scheduleMode),
'payload': payload ?? '',
...scheduledDate.toMap(),
if (matchDateTimeComponents != null)
'matchDateTimeComponents': matchDateTimeComponents.index
},
);
}