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

ie: [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FormatException: Invalid envelope #60

Closed
Rajeshhmuthyala opened this issue Nov 13, 2019 · 9 comments
Labels
question Further information is requested

Comments

@Rajeshhmuthyala
Copy link

await ContactsService.addContact(Contact(
givenName: contactdetails.Firstname,
phones: [phoneNumber]
));

@COCPORN
Copy link

COCPORN commented Nov 30, 2019

I am getting the same issue. Let me know if you need help to reproduce.

@hsul4n
Copy link

hsul4n commented Dec 8, 2019

Same problem here!!

@lukasgit
Copy link
Owner

@Rajeshhmuthyala @COCPORN @hsult4n please post steps / code to reproduce. Thanks

@lukasgit lukasgit added the question Further information is requested label Dec 21, 2019
@COCPORN
Copy link

COCPORN commented Dec 22, 2019

Disclaimer: I am totally new to flutter. I can provide a full repo that compiles and runs, but this here is the offending code:

  void _saveNumber() {
    debugPrint('Saving number ${numberController.text}'); 
    PostalAddress address = PostalAddress(label: "Home");
    Contact contact = Contact(
      displayName: nameController.text,
      givenName: nameController.text,
      phones: [Item(label: 'mobile', value: numberController.text)],
      postalAddresses: [address]      
    );
    ContactsService.addContact(contact);
    setState(() {
      numberController.text = '';
      nameController.text = '';
    });
  }

@Sthefanny
Copy link

same problem... any solutions?

@AndreyMolochko
Copy link

The same problem

@AndreyMolochko
Copy link

AndreyMolochko commented Jan 24, 2020

I had the same problem. For solving this problem you should apply permissions on write data in contacts. It's a dangerous permissions, so add permission only in manifest is not enough. For call window applying or dinying permissions you can use permission_handler 4.2.0 .

await PermissionHandler().requestPermissions([PermissionGroup.contacts]);

After calling this method you can apply permission and contact will be added. By the way, this solution is needed only for android devices with Android 6.0 (API level 23) or higher. In lower versions you apply all permissions, when install your app.

This question is on StackOverFlow. You can raise a question and answer this on StackOverFlow to inform more people.
https://stackoverflow.com/questions/57969216/getting-this-error-unhandled-exception-formatexception-invalid-envelope-wh/59891554#59891554

@isojtouano
Copy link

@AndreyMolochko 's answer worked for me, thanks!

@lukasgit
Copy link
Owner

#60 (comment) looks like the working solution here. Closing this issue.

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

No branches or pull requests

7 participants