convertAppointmentToObject method

T? convertAppointmentToObject(
  1. T customData,
  2. Appointment appointment

Converts the Appointment data to the custom business object data.

Note_:_ When business object used to set data for SfCalendar, this method must be implemented to get the data with business object type when drag and drop and appointment resizing enabled.

class _DataSource extends CalendarDataSource<_Meeting> {
  _DataSource(List<_Meeting> source) {
    appointments = source;

  DateTime getStartTime(int index) {
    return appointments![index].from as DateTime;

  DateTime getEndTime(int index) {
    return appointments![index].to as DateTime;

  String getSubject(int index) {
    return appointments![index].content as String;

  Color getColor(int index) {
    return appointments![index].background as Color;

  _Meeting convertAppointmentToObject(
      _Meeting customData, Appointment appointment) {
    return _Meeting(
        from: appointment.startTime,
        to: appointment.endTime,
        content: appointment.subject,
        background: appointment.color,
        isAllDay: appointment.isAllDay);


T? convertAppointmentToObject(T customData, Appointment appointment) => null;