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

contact is added but plugin is throwing exception #27

Open
kw2019ltd opened this issue Oct 2, 2020 · 6 comments
Open

contact is added but plugin is throwing exception #27

kw2019ltd opened this issue Oct 2, 2020 · 6 comments

Comments

@kw2019ltd
Copy link

trying to add Contact using Contacts.addContact(contact); using flutter_contact: ^0.6.4

  var contact =
      Contact(givenName: 'HHH', displayName: 'dd', identifier: '234234');
      Contacts.addContact(contact);

getting below error but contact is being added see below screen pls fix it

{identifier: 234234, displayName: dd, givenName: HHH, middleName: null, familyName: null, lastModified: null, unifiedContactId: null, singleContactId: null, otherKeys: {}, prefix: null, suffix: null, company: null, jobTitle: null, emails: [], phones: [], dates: [], socialProfiles: [], urls: [], postalAddresses: [], avatar: null, note: null}

I/flutter ( 5100): ══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
I/flutter ( 5100): The following PlatformException was thrown:
I/flutter ( 5100): PlatformException(notFound, in method getContact: Expected a single result for contact
I/flutter ( 5100): ContactKeys(mode=UNIFIED, unifiedContactId=1226, singleContactId=null, lookupKey=null), but instead
I/flutter ( 5100): found 0, co.sunnyapp.flutter_contact.MethodCallException: notFound: in method getContact: Expected a
I/flutter ( 5100): single result for contact ContactKeys(mode=UNIFIED, unifiedContactId=1226, singleContactId=null,
I/flutter ( 5100): lookupKey=null), but instead found 0)

image

@ericmartineau
Copy link
Contributor

Is this ios? Android? And does it happen every time? Or just sometimes?

@Chinmay-KB
Copy link

I am getting the same error, I am providing display name, family name and phones

@ericmartineau
Copy link
Contributor

I haven't tested the behavior, but I don't think you should be providing an identifier - I believe that should be set by the underlying framework. What happens if you remove the identifier field?

@rmortes
Copy link
Contributor

rmortes commented Jun 21, 2021

Related to #11

@GeylanKalafMohe
Copy link

Issue still happens. Please fix it

await Contacts.addContact(Contact(givenName: 'HHH', displayName: 'dd'));

PlatformException (PlatformException(notFound, in method getContact: Expected a single result for contact ContactKeys(mode=UNIFIED, unifiedContactId=220335, singleContactId=null, lookupKey=null), but instead found 0, co.sunnyapp.flutter_contact.MethodCallException: notFound: in method getContact: Expected a single result for contact ContactKeys(mode=UNIFIED, unifiedContactId=220335, singleContactId=null, lookupKey=null), but instead found 0, null))

@GeylanKalafMohe
Copy link

Temp fix is to just put it in try catch but not handle the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants