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;
  }

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

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

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

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

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

Implementation

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