Articles in this section
Category / Section

How to exclude the dates from recurrence appointments in the Flutter Calendar

2 mins read

In the Flutter Event Calendar, you can exclude the occurrence from recurrence appointment by using the recurrenceExceptionDates property of the Appointment.

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
 
void main() => runApp(RecurrenceException());
 
class RecurrenceException extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: SafeArea(
          child: SfCalendar(
            view: CalendarView.week,
            dataSource: _getCalendarDataSource(),
          ),
        ),
      ),
    );
  }
 
  _AppointmentDataSource _getCalendarDataSource() {
    List<Appointment> appointments = <Appointment>[];
    DateTime exceptionDate = DateTime(2020, 12, 23);
    appointments.add(Appointment(
        startTime: DateTime.now(),
        endTime: DateTime.now().add(Duration(hours: 1)),
        subject: 'Meeting',
        color: Colors.pink,
        recurrenceRule:
        'FREQ=DAILY;COUNT=20',
        recurrenceExceptionDates: <DateTime>[exceptionDate]));
    )
    );
 
    return
    _AppointmentDataSource
    (
    appointments
    );
  }
}
 
class _AppointmentDataSource extends CalendarDataSource {
  _AppointmentDataSource(List<Appointment> source) {
    appointments = source;
  }
}

View sample in GitHub

Flutter calendar recurrence appointment

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied