Closed ARAVINDKARATE closed 1 year ago
I am not having this problem. I think you need to be more specific what is not working for you in order to get better help.
Can confirm that adding events to a calendar does not work in release mode. I have used thoroughly tested this in debug mode and it works fine. In release mode, I am attempting to catch the error which fails the following is
check. It is clearly a ResultError
but somehow `ex is ResultError returns false. In summary, I have no way to figure out what the problem is.
try {
await _calendarPlugin.createOrUpdateEvent(deviceEvent)
} catch (ex) {
if (ex is ResultError) {
print('result error');
}
}
Apparently this library throws a List<ResultError>
instead of a single ResultError
. Here is my code:
final calendarsResult = await _calendarPlugin.retrieveCalendars();
if (!calendarsResult.isSuccess) {
throw 'Failed to retrieve calendars';
} else if (calendarsResult.data == null || calendarsResult.data!.isEmpty) {
throw 'Could not find any calendars';
}
calendarsResult.data!.forEach((calendar) {
print('${calendar.id} ${calendar.name}, default: ${calendar.isDefault}, readOnly: ${calendar.isReadOnly}');
});
In debug mode it successfully retrieves all calendars and print the data correctly. In release mode, calendar.id
, calendar.name
, etc. are all null
. So the core problem is that I don't actually have a calendarId to save events to because it is null.
@ARAVINDKARATE @zakton5 Please provide more details, such as:
flutter doctor -v
while you're at itI found the section on the R8 proguard issue. I followed those steps and everything works well now.
I have integrated the device calendar plugin in my project and all the functions are working fine when I run the code but when I run it in release mode or make a built to release, these functionalities are not working