Welcome to the Flutter feedback portal. We’re happy you’re here! If you have feedback on how to improve the Flutter, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Hi, I'm trying to implement drag and drop on my mobile device. I have the initial part working but there is an error when the drag is finished. I have my custom class "Appt" and I have implemented convertAppointmentToObject method but it's still not working. Obviously I've done something wrong but I don't know what. I've followed the documentation as far as I can tell. What am I doing wrong? Any help would be greatly appreciated. Thank you!
If I change the customData type to Appt I get this error:
'MeetingDataSource.convertAppointmentToObject' ('Appt? Function(Appt?, Appointment)') isn't a valid override of 'CalendarDataSource.convertAppointmentToObject' ('Object? Function(Object?, Appointment)').
My convert method is this:
@override Appt? convertAppointmentToObject( Object? customData, Appointment appointment) {
// TODO: implement convertAppointmentToObject
return Appt(appointment.startTime, appointment.endTime, appointment.color, subject: appointment.subject, recurrenceRule: appointment.recurrenceRule);
}
══╡ EXCEPTION CAUGHT BY GESTURE ╞═════════════════════════════════════════
The following _TypeError was thrown while handling a gesture:
type 'Appointment' is not a subtype of type 'Appt' of 'value'
When the exception was thrown, this was the stack:
#0 List.add (dart:core-patch/growable_array.dart)
#1 _CustomCalendarScrollViewState._handleLongPressEnd
(package:syncfusion_flutter_calendar/src/calendar/views/calendar_view.dart:2286:47)
#2 _CustomCalendarScrollViewState.build.
(package:syncfusion_flutter_calendar/src/calendar/views/calendar_view.dart:659:15)
#3 LongPressGestureRecognizer._checkLongPressEnd.
(package:flutter/src/gestures/long_press.dart:789:71)
#4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#5 LongPressGestureRecognizer._checkLongPressEnd (package:flutter/src/gestures/long_press.dart:789:11)
#6 LongPressGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/long_press.dart:633:9)
#7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:563:9)
#8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#9 PointerRouter._dispatchEventToRoutes.
#10 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:614:13)
#11 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#12 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#13 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:445:19)
#14 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:425:22)
#15 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:329:11)
#16 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:380:7)
#17 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:344:5)
#18 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:302:7)
#19 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:285:7)
#23 _invoke1 (dart:ui/hooks.dart:170:10)
#24 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:331:7)
#25 _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
(elided 3 frames from dart:async)