zonedSchedule method
Future<void>
zonedSchedule({
- required int id,
- String? title,
- String? body,
- required TZDateTime scheduledDate,
- String? payload,
- DateTimeComponents? matchDateTimeComponents,
- AndroidNotificationDetails? notificationDetails,
- AndroidScheduleMode scheduleMode = AndroidScheduleMode.exact,
override
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
@override
Future<void> zonedSchedule({
required int id,
String? title,
String? body,
required tz.TZDateTime scheduledDate,
String? payload,
DateTimeComponents? matchDateTimeComponents,
AndroidNotificationDetails? notificationDetails,
AndroidScheduleMode scheduleMode = AndroidScheduleMode.exact,
}) 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,
});
}