fluttercommunity / flutter_contacts

Contacts Service - A Flutter plugin to retrieve and manage contacts on Android and iOS devices. Maintainer: @lukasgit
https://pub.dev/packages/contacts_service
MIT License
153 stars 69 forks source link

Contact not updating #97

Closed nishin-login2 closed 4 years ago

nishin-login2 commented 5 years ago

I have given both read, write contact permissions in manifest file. I could fetch contacts and display it in a list. But updating a contact is not working. Below is my code.


import 'package:contacts_service/contacts_service.dart';

...

_buildContactList() {
    final contactList = await ContactsService.getContacts().toList();
    return ListView.builder(
        itemCount: contactList.length,
        shrinkWrap: true,
        itemBuilder: (context, index) {
          final Contact item = contactList.elementAt(index);
          return ListTile(
            title: Text(item.displayName),
            onLongPress: () async{
              item.displayName = "Modified ${item.displayName}";
              final result = await ContactsService.updateContact(item);
              print(result); // prints "null"
            },
          );
        });
  }

What am I doing wrong?

lukasgit commented 5 years ago

@nishin-login2 are you using the latest version?

jordy-garcia commented 5 years ago

I have this same issue, when I try to update contact, it erase its phone number and not apply any change

lukasgit commented 5 years ago

@nishin-login2 @jordy-garcia please use the latest code from https://github.com/lukasgit/flutter_contacts and let me know if that solves the problem. Thanks!

jordy-garcia commented 5 years ago

@nishin-login2 @jordy-garcia please use the latest code from https://github.com/lukasgit/flutter_contacts and let me know if that solves the problem. Thanks!

Yes It still has the same behaviour, try it in real devices and you'll see. In emulators it works well, but on real devices it erases the phone number

JoseVargas05 commented 4 years ago

I have seen that the pattern of contacts that cannot be modified have a link to the icloud or to another platform, for this reason it is impossible to modify it .. A contact normally stored in the cell phone if it can be modified. Is there a way to detect if the contact is synchronized or saved normally?

lukasgit commented 4 years ago

Please submit issues and PR's to https://github.com/lukasgit/flutter_contacts