Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

how to update contact in flutter

I use contact service to update my contacts, but it does not work, the contact number is remove. i use contact service contacts_service: ^0.4.6


Future updateContact(Contact contact, part) async{
    
    Iterable<Item> phones = contact.phones;
    List newPhones = [];

    for(var phone in phones){
      String newPhone;
      if(part == 0) newPhone = "22489653214";
      else newPhone = "22489653214";

      newPhones.add(Item(label: phone.label, value: newPhone));
    }

    contact.phones = newPhones.map((e) => e);
    await ContactsService.updateContact(contact);
  }

question from:https://stackoverflow.com/questions/65886060/how-to-update-contact-in-flutter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...