Search code examples
loopsfluttercontacts

Flutter contacts_service package use


I am using https://pub.dev/packages/contacts_service. I am able to do:

contacts.forEach((contact){
      print(contact.displayName);
});

How do I print items of contact.emails ? They are defined as Iterable


Solution

  • Try this;

    contacts.forEach((contact) {
      print(contact.displayName);
      contact.emails.forEach((item) {
        print(item.value);
      });
    });