generateRRule static method
String
generateRRule(
- RecurrenceProperties recurrenceProperties,
- DateTime appStartTime,
- DateTime appEndTime
Generates the recurrence rule based on the given recurrence properties and the start date and end date of the recurrence appointment.
Used to generate recurrence rule based on the recurrence properties.
- recurrenceProperties - required - the recurrence properties to generate the recurrence rule.
- appStartTime - required - the recurrence appointment start time.
- appEndTime - required - the recurrence appointment end time.
returns String
.
See also:
- RecurrenceProperties, to know more about the available recurrence properties which helps to create the recurrence rule.
- parseRRule, to generate the recurrence properties based on the recurrence rule.
- Appointment.recurrenceRule, to set the recurrence rule for the Appointment, which will recur based on the given rule.
- TimeRegion.recurrenceRule, to set the recurrence rule for the TimeRegion, which will recur based on the given rule.
RecurrenceProperties recurrenceProperties =
RecurrenceProperties(startDate: DateTime.now());
recurrenceProperties.recurrenceType = RecurrenceType.daily;
recurrenceProperties.recurrenceRange = RecurrenceRange.count;
recurrenceProperties.interval = 2;
recurrenceProperties.recurrenceCount = 10;
Appointment appointment = Appointment(
startTime: DateTime(2019, 12, 16, 10),
endTime: DateTime(2019, 12, 16, 12),
subject: 'Meeting',
color: Colors.blue,
recurrenceRule: SfCalendar.generateRRule(recurrenceProperties,
DateTime(2019, 12, 16, 10), DateTime(2019, 12, 16, 12)));
Implementation
static String generateRRule(RecurrenceProperties recurrenceProperties,
DateTime appStartTime, DateTime appEndTime) {
assert(CalendarViewHelper.isSameOrBeforeDateTime(appEndTime, appStartTime));
assert(CalendarViewHelper.isSameOrAfterDateTime(appStartTime, appEndTime));
return RecurrenceHelper.generateRRule(
recurrenceProperties, appStartTime, appEndTime);
}