SyncFusion Calendar & Google Calendar API - Recursive Events Not Showing

I have a Flutter Android app with a SfCalendar that receives events from Google Calendar. All the events are displayed except for recurring events. It only shows them in the first month but no other months. 

I tried following this post and added the following snippet to my code but I got a different error:

@overrideStringgetRecurrenceRule(intindex) {
return appointments![index].recurrence==null?"":appointments![index].recurrence[0];
}


══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════

The following FormatException was thrown building FutureBuilder<List<Event>>(state:
_FutureBuilderState<List<Event>>#4c76c):
Invalid number (at character 1)


^


The relevant error-causing widget was:
  FutureBuilder<List<Event>>
  FutureBuilder:file:///home/dcook/Flutter/ashburn_demolay/lib/home_screen.dart:15:10


When the exception was thrown, this was the stack:
#0 int._handleFormatError (dart:core-patch/integers_patch.dart:124:7)
#1 int.parse (dart:core-patch/integers_patch.dart:50:14)
#2 RecurrenceHelper._getMonthlyRecurrenceDateTimeCollection
(package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart:744:37)
#3 RecurrenceHelper.getRecurrenceDateTimeCollection
(package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart:1077:14)
#4 _SfCalendarState._isAppointmentBetweenDates (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:5412:28)
#5 _SfCalendarState._removeScheduleViewAppointmentDates (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:4691:12)
#6 _SfCalendarState.didUpdateWidget (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:2987:7)
#7 StatefulElement.update (package:flutter/src/widgets/framework.dart:5652:55)
#8 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#9 Element.updateChildren (package:flutter/src/widgets/framework.dart:3973:32)
#10 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6918:17)
#11 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#13 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#14 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#15 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2904:19)
#16 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:989:21)
#17 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:5)
#18 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:15)
#19 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:9)
#20 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:5)
#21 _invoke (dart:ui/hooks.dart:312:13)
#22 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:5)
#23 _drawFrame (dart:ui/hooks.dart:283:31)


════════════════════════════════════════════════════════════════════════════════════════════════════


Another exception was thrown: FormatException: Invalid number (at character 1)
Another exception was thrown: Each child must be laid out exactly once.
Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 5926 pos 14: '_dependents.isEmpty': is
not true.
Another exception was thrown: Tried to build dirty widget in the wrong build scope.
E/flutter (27090): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Invalid number (at character 1)
E/flutter (27090):
E/flutter (27090): ^
E/flutter (27090):
E/flutter (27090): #0 int._handleFormatError (dart:core-patch/integers_patch.dart:124:7)
E/flutter (27090): #1 int.parse (dart:core-patch/integers_patch.dart:50:14)
E/flutter (27090): #2 RecurrenceHelper._getMonthlyRecurrenceDateTimeCollection (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart:744:37)
E/flutter (27090): #3 RecurrenceHelper.getRecurrenceDateTimeCollection (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart:1077:14)
E/flutter (27090): #4 AppointmentHelper._getRecurrenceAppointments (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/appointment_helper.dart:1396:26)
E/flutter (27090): #5 AppointmentHelper.getVisibleAppointments (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/appointment_helper.dart:999:9)
E/flutter (27090): #6 _SfCalendarState._updateVisibleAppointments (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:4014:35)
E/flutter (27090): #7 _SfCalendarState._getAppointment (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:3989:5)
E/flutter (27090): #8 _SfCalendarState.didUpdateWidget (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:2979:7)
E/flutter (27090): #9 StatefulElement.update (package:flutter/src/widgets/framework.dart:5652:55)
E/flutter (27090): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
E/flutter (27090): #11 Element.updateChildren (package:flutter/src/widgets/framework.dart:3973:32)
E/flutter (27090): #12 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6918:17)
E/flutter (27090): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
E/flutter (27090): #14 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
E/flutter (27090): #15 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
E/flutter (27090): #16 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
E/flutter (27090): #17 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2904:19)
E/flutter (27090): #18 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:989:21)
E/flutter (27090): #19 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:5)
E/flutter (27090): #20 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:15)
E/flutter (27090): #21 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:9)
E/flutter (27090): #22 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:5)
E/flutter (27090): #23 _invoke (dart:ui/hooks.dart:312:13)
E/flutter (27090): #24 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:5)
E/flutter (27090): #25 _drawFrame (dart:ui/hooks.dart:283:31)
E/flutter (27090):
Another exception was thrown: FormatException: Invalid number (at character 1)

I have also tried running `flutter clean' & 'flutter pub git' as well as deleting and reinstalling the app, running the same steps on a different device

you can find the code here


1 Reply 1 reply marked as answer

YG Yuvaraj Gajaraj Syncfusion Team March 26, 2024 11:05 AM UTC

Hi Dresden,


We have checked the shared sample and found that in the given recurrence rule you have passed the invalid recurrence rule which is why it through the invalid number error. In your recurrence rule, you have given `FREQ=MONTLY` and `BYDAY=WE` but you don't mention the BYSETPOS field in the rule. To resolve this you need to set the BYSETPOS value in the rule and we also shared the UG documentation below for your reference.


UG, https://help.syncfusion.com/flutter/calendar/appointments#recurrence-rule


Regards,

Yuvaraj.


Marked as answer
Loader.
Up arrow icon