Importing Contacts in Flutter

Gbolahan
Aug 26, 2022

--

We would be using contacts_service plugin on pub dev as at writing the article the version is ^0.6.3, A Flutter plugin to access and manage the device’s contacts.

It both works for Android and IOS, you just have to add some permissions

Android

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_CONTACTS" />  
<uses-permission android:name="android.permission.WRITE_CONTACTS" />

iOS

Set the NSContactsUsageDescription in your Info.plist file

<key>NSContactsUsageDescription</key>  
<string>This app requires contacts access to function properly.</string>

Then you ask for permission

Code for Importing , remember to refactor how ever it works for you

Populating the list

Incase you run into any problem , you can use the example project

https://github.com/lukasgit/flutter_contacts/blob/master/example/lib/main.dart

--

--

Gbolahan

I'm a Mobile Developer (Flutter) , Interested In science and how it's suppose to help.