Open sumitrvi opened 1 year ago
This looks more like the device's problem on syncing Google calendar to/from the cloud
Which I'm not sure we can help with the APIs on hand. Maybe a lastSynced
? (no idea if that data is available either)
When I am updating an event in the flutter application it is throwing an exception in the devices(in which updation is not reflecting on google calendar) in debug mode.
/// Creates or updates an event
///
/// The event paramter specifies how event data should be saved into the calendar
/// Always specify the [Event.calendarId], to inform the plugin in which calendar
/// it should create or update the event.
///
/// Returns a [Result] with the newly created or updated [Event.eventId]
Future<Result<String>?> createOrUpdateEvent(Event? event) async {
if (event == null) return null;
return _invokeChannelMethod(
ChannelConstants.methodNameCreateOrUpdateEvent,
assertParameters: (result) {
// Setting time to 0 for all day events
if (event.allDay == true) {
if (event.start != null) {
var dateStart = DateTime(event.start!.year, event.start!.month,
event.start!.day, 0, 0, 0);
// allDay events on Android need to be at midnight UTC
event.start = Platform.isAndroid
? TZDateTime.utc(event.start!.year, event.start!.month,
event.start!.day, 0, 0, 0)
: TZDateTime.from(dateStart,
timeZoneDatabase.locations[event.start!.location.name]!);
}
if (event.end != null) {
var dateEnd = DateTime(
event.end!.year, event.end!.month, event.end!.day, 0, 0, 0);
// allDay events on Android need to be at midnight UTC on the
// day after the last day. For example, a 2-day allDay event on
// Jan 1 and 2, should be from Jan 1 00:00:00 to Jan 3 00:00:00
event.end = Platform.isAndroid
? TZDateTime.utc(event.end!.year, event.end!.month,
event.end!.day, 0, 0, 0)
.add(const Duration(days: 1))
: TZDateTime.from(dateEnd,
timeZoneDatabase.locations[event.end!.location.name]!);
}
}
_assertParameter(
result,
!(event.allDay == true && (event.calendarId?.isEmpty ?? true) ||
event.start == null ||
event.end == null),
ErrorCodes.invalidArguments,
ErrorMessages.createOrUpdateEventInvalidArgumentsMessageAllDay,
);
_assertParameter(
result,
!(event.allDay != true &&
((event.calendarId?.isEmpty ?? true) ||
event.start == null ||
event.end == null ||
(event.start != null &&
event.end != null &&
event.start!.isAfter(event.end!)))),
ErrorCodes.invalidArguments,
ErrorMessages.createOrUpdateEventInvalidArgumentsMessage,
);
},
arguments: () => event.toJson(),
);
}
Here when debug goes to this following below line:- arguments: () => event.toJson(), this return the below exception:- "PlatformException(500, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null, null)"
This exception is coming in the devices in which the details(title, location, description, start date & end date) are not updating on google calendar when editing an event in the flutter application. there are the following devices on which updation on google calendar is not working and these devices are throwing exceptions in debug mode:-
But the devices in which the updation of events on the flutter application is also reflected on google calendar are not throwing any exception in debug mode. Like in the Samsung Galaxy M10 device.
Any solution in this? I am facing the same issue for my flutter application.
I am trying to update an already created event. But getting the following error:
PlatformException(500, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null, null)
Device calendar plugin ran into an issue. Platform specific exception [500], with message :"Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference", has been thrown.
It works as expected on iOS devices. I think just fails to update the event on android devices.
Android device: OnePlus Nord 2
I'm facing the same issue, also with an Android Device. I've thought of deleting and recreating the Event with the users alterations, but the eventID being a read-only makes it a lot harder to keep track of the alterations in my database which is also a big problem.
Any advice as to how we can properly update events?
I second this. I'm getting the same error when updating an event.
I have the same issue
I got around it by just removing the device event and creating a new one. The downside is that any changes that were made to the event outside of the app need to be copied over.
On Sat, Mar 9, 2024, 02:34 Allen Xu @.***> wrote:
I have the same issue
— Reply to this email directly, view it on GitHub https://github.com/builttoroam/device_calendar/issues/467#issuecomment-1986679871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAETNIRMJHGQQMYSPWZ5M63YXJRKFAVCNFSM6AAAAAATPPTOQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWGY3TSOBXGE . You are receiving this because you commented.Message ID: @.***>
I am running flutter application in Android devices, when i am creating an event in flutter application then it is also visible on Google Calendar with all details that i added in flutter application using createOrUpdateEvent() method. But the problem is that when i updating an already created event's details( title, description, location, start date and end date ) in flutter application then it is not updating in Google Calendar. I am also not receiving any exception or error in debug mode while updating details.
I am facing this issue in almost android devices. But in some android devices(like Samsung Galaxy M10) when i am updating details(title, start date etc.) then these details are also changing in Google Calendar.
Working correct in following devices:-
Not working in following devices:-
I am using device_calendar latest version that is ^4.2.0
Flutter doctor [✓] Flutter (Channel stable, 3.3.9, on macOS 12.6.1 21G217 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [✓] Xcode - develop for iOS and macOS (Xcode 14.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.73.1) [✓] Connected device (3 available) [✓] HTTP Host Availability