recurrenceExceptionDates property
Delete the occurrence for an recurrence appointment.
An Appointment with recurrenceRule will recur on all the possible dates given by the recurrenceRule.
If it is not null
the recurrence appointment occurrence can be deleted
and the appointment will not occur on the dates set to this property in
Calendar
.
Defaults to <DateTime>[]
.
See also:
- CalendarDataSource.getRecurrenceExceptionDates, which maps the custom business objects corresponding property to this property.
- recurrenceRule, which used to generate the recurrence appointment based on the rule set.
- RecurrenceProperties, which used to create the recurrence rule based on the values set to these properties.
- SfCalendar.generateRRule, which used to generate recurrence rule based on the RecurrenceProperties values.
- Knowledge base: How to exclude the dates from the recurrence appointments
Widget build(BuildContext context) {
return Container(
child: SfCalendar(
view: CalendarView.day,
dataSource: _getCalendarDataSource(),
),
);
}
class DataSource extends CalendarDataSource {
DataSource(List<Appointment> source) {
appointments = source;
}
}
DataSource _getCalendarDataSource() {
List<Appointment> appointments = <Appointment>[];
RecurrenceProperties recurrence =
RecurrenceProperties(startDate: DateTime.now());
recurrence.recurrenceType = RecurrenceType.daily;
recurrence.interval = 2;
recurrence.recurrenceRange = RecurrenceRange.noEndDate;
recurrence.recurrenceCount = 10;
appointments.add(
Appointment(
startTime: DateTime.now(),
endTime: DateTime.now().add(
Duration(hours: 2)),
isAllDay: true,
subject: 'Meeting',
color: Colors.blue,
startTimeZone: '',
notes: '',
location: '',
endTimeZone: '',
recurrenceRule: SfCalendar.generateRRule(
recurrence, DateTime.now(), DateTime.now().add(
Duration(hours: 2))),
recurrenceExceptionDates: [
DateTime.now().add(Duration(days: 2))
]
));
return DataSource(appointments);
}
Implementation
List<DateTime>? recurrenceExceptionDates;