Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add events to calendar with plugin version 3.0.0 #152

Closed
FedericoMatera opened this issue Jan 27, 2020 · 7 comments
Closed

Unable to add events to calendar with plugin version 3.0.0 #152

FedericoMatera opened this issue Jan 27, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@FedericoMatera
Copy link
Contributor

Just updated to version 3.0.0 and I'm unable to save a new event.

Got this error message:
type 'NoSuchMethodError' is not a subtype of type 'Exception'
in DeviceCalendarPlugin.createOrUpdateEvent (package:device_calendar/src/device_calendar.dart:202:54)

@vondeetzen
Copy link

I've setup an example repository here https://github.com/vondeetzen/dc_nosucherrormethod_example with a short tutorial how to reproduce the error. Ran into it a day before.

When I'm running the example project (https://github.com/builttoroam/flutter_plugins/tree/develop/device_calendar/example) it works. Currenlty tested only on iOS 13 simulator (iPhone 11). So I'm currently assuming that there was a mistake while setting device_calendar up or I'm using the code wrong. Permission for the calendar were added in Info.plist.

Running on macOS Catalina and Flutter

$ flutter --version
Flutter 1.12.13+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 27321ebbad (7 weeks ago) • 2019-12-10 18:15:01 -0800
Engine • revision 2994f7e1e6
Tools • Dart 2.7.0

Exception thrown is

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: type 'NoSuchMethodError' is not a subtype of type 'Exception'
#0      DeviceCalendarPlugin.createOrUpdateEvent (package:device_calendar/src/device_calendar.dart:202:54)
#1      _MyHomePageState.build.<anonymous closure> (package:dc_nosucherrormethod_example/main.dart:71:39)
<asynchronous suspension>
#2      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
#3      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:789:36)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
#5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
#6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
#7      BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:199:7)
#8      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.da<…>

Looked at /[...shortened].../.pub-cache/hosted/pub.dartlang.org/device_calendar-3.0.0/lib/src/device_calendar.dart:202 and found the line:

_parsePlatformExceptionAndUpdateResult<String>(e, res);

For debugging purposes I've added a statement

print('e = >$e< and res.success = >${res.isSuccess}< and res.data=>${res.data}<');
_parsePlatformExceptionAndUpdateResult<String>(e, res);

before and got:

e = >NoSuchMethodError: The getter 'data' was called on null.
Receiver: null
Tried calling: data< and res.success = >false< and res.data=>null<

(linebreak was added by the print statement not by me).

@vondeetzen
Copy link

Small addition: 2.0.0 also does not work for me (same NoSuchMethodError issue). Everything working fine with 1.0.0+3.

@bhl09
Copy link
Contributor

bhl09 commented Jan 27, 2020

Thanks for the details @FedericoMatera, @vondeetzen. I've had a look and found out I didn't set Uri property for the event to be null-aware - event.url

I'll make sure to add this into next update, as a workaround for now, please set an empty string to the url property of the event: event.url = Uri.dataFromString('')

@bhl09 bhl09 self-assigned this Jan 27, 2020
@bhl09 bhl09 added the bug Something isn't working label Jan 27, 2020
@bhl09 bhl09 added this to To do in Device_Calendar plugin v3.1.0 via automation Jan 27, 2020
@bhl09 bhl09 moved this from To do to In progress in Device_Calendar plugin v3.1.0 Jan 27, 2020
@bhl09 bhl09 removed this from In progress in Device_Calendar plugin v3.1.0 Jan 27, 2020
@bhl09 bhl09 moved this from To do to In progress in Device_Calendar plugin v3.0.0+1 Jan 27, 2020
@bhl09
Copy link
Contributor

bhl09 commented Jan 27, 2020

@FedericoMatera, @vondeetzen, a hotfix v3.0.0+1 has been released now, update the dependency and you shouldn't be getting the error message anymore. You can discard the workaround.

@bhl09 bhl09 closed this as completed Jan 27, 2020
@bhl09 bhl09 moved this from In progress to Done in Device_Calendar plugin v3.0.0+1 Jan 27, 2020
@FedericoMatera
Copy link
Contributor Author

Hi @Brett09 ,
now I have a different error:
Failed assertion: boolean expression must not be null
at DeviceCalendarPlugin.createOrUpdateEvent (package:device_calendar/src/device_calendar.dart:170:15)

allDay is nullable, i think

@FedericoMatera
Copy link
Contributor Author

I created this PR:
#157

@nickrandolph
Copy link
Contributor

@FedericoMatera thank you for the patience and contribution. We'll get this reviewed (I've done an initial pass already and it looks good) and merged asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

4 participants