syncfusion/flutter-examples

[Sf_Calendar] latest versions assume that there is a "notes" getter in custom appointment models.

Wizzel1 opened this issue · 3 comments

In verson 24.2.9 I am getting an error when tapping on an appointment in my calendar.

NoSuchMethodError: NoSuchMethodError: Class '_$AssessmentImpl' has no instance getter 'notes'.
Receiver: Instance of '_$AssessmentImpl'
Tried calling: notes
  File "calendar_view_helper.dart", line 584, in CalendarViewHelper.raiseCalendarTapCallback
  File "calendar_view.dart", line 9027, in _CalendarViewState._handleTouchOnMonthView
  File "calendar_view.dart", line 8909, in _CalendarViewState._handleOnTapForMonth
...
(16 additional frame(s) were not displayed)

This happens because you are assuming that my model has a notes getter:

  /// method that raise the calendar tapped callback with the given parameters
  static void raiseCalendarTapCallback(
      SfCalendar calendar,
      DateTime? date,
      List<dynamic>? appointments,
      CalendarElement element,
      CalendarResource? resource) {
    if (appointments != null && appointments.isNotEmpty) {
      for (final dynamic appointment in appointments) {
        ///Throws an error with any model that does not implement a notes getter.
        String? notes = appointment.notes;                                                  
        if (notes != null && notes.isNotEmpty) {
          notes = notes.replaceAll('isOccurrenceAppointment', '');
          appointment.notes = notes;
        }
      }
    }
    calendar.onTap!(CalendarTapDetails(appointments, date, element, resource));
  }

Hi @Wizzel1 ,

We would like to let you know that the reported issue is already fixed and it will be rolled out in our Volume 1 main release which is expected to be rolled out on the 3rd week of March 2024. We will update you here once the release is rolled out and we appreciate your patience until then.

Regards,
Yuvaraj.

The reported issue regarding the notes field method not found exception has been fixed and rolled out in our Volume 1 2024 main release. To avoid this please upgrade your package to the latest version mentioned below.

Latest package: https://pub.dev/packages/syncfusion_flutter_calendar/versions/25.1.35

Thanks