endTime property

DateTime endTime
read / write

The end time for an Appointment in SfCalendar.

Defaults to DateTime.now().

Note: If this property set with the time prior to the startTime, then the Appointment will render with half hour time period from the startTime.

If the difference between startTime and endTime is greater than 24 hour the appointment will be rendered on the all day panel of the time slot views in SfCalendar.

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>[];
   appointments.add(
       Appointment(
         startTime: DateTime.now(),
         endTime: DateTime.now().add(
             Duration(hours: 2)),
         isAllDay: true,
         subject: 'Meeting',
         color: Colors.blue,
         startTimeZone: '',
         endTimeZone: ''
       ));

  return DataSource(appointments);
}

Implementation

DateTime endTime;