recurrenceRule property

String? recurrenceRule
getter/setter pair

Recurs the Appointment on SfCalendar.

An Appointment will render the one appointment view for the given startTime and endTime in SfCalendar.

If it is not null the appointment will be recurred multiple times based on the RecurrenceProperties set to this property.

The recurrence rule can be generated using the SfCalendar.rRuleGenerator method in Calendar.

The recurrence rule can be directly set this property like 'FREQ=DAILY;INTERVAL=1;COUNT=3'.

Defaults to null.

See also:

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.count;
   recurrence.recurrenceCount = 10;
   appointments.add(Appointment(
       startTime: DateTime.now(),
       endTime: DateTime.now().add(Duration(hours: 2)),
       isAllDay: true,
       subject: 'Meeting',
       color: Colors.blue,
       startTimeZone: '',
       endTimeZone: '',
       recurrenceRule: SfCalendar.generateRRule(recurrence,
           DateTime.now(), DateTime.now().add(Duration(hours: 2)))));

   return DataSource(appointments);
 }

Implementation

String? recurrenceRule;