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

how can get all contacts no in flutter with your plugin #13

Closed reeteshkumar39 closed 6 years ago

reeteshkumar39 commented 6 years ago

how can get all contacts phone number from user phone in a list?

clovisnicolas commented 6 years ago

I'm not sure to understand what you need

var allContacts = await ContactsService.getContacts();
var filtered = allContacts.where((c) => c.phones.any((phone) => phone.value.contains("123456789"))).toList();

Here's how you can fetch contacts matching a phone number

clovisnicolas commented 6 years ago

Ok I think I understood what you want, is it something like

    var phones = [];
    contacts.forEach((contact) => contact.phones.forEach((phone) => phones.add(phone.value)));
reeteshkumar39 commented 6 years ago

thank you.......it works