Flutter Contacts Plugin

pub package

A Flutter contacts plugin which provides easy access to the platform specific address book.

BranchBuild Status
developBuild Status
masterBuild Status

Features

  • Automatically check and request the necessary permissions to access the platform specific address book;
  • Read contacts from the addres book;
  • WIP Store new contacts in the address book;
  • WIP Update details of existing contacts;
  • WIP Delete existing contacts from the address book.

Usage

To use this plugin, add contacts_plugin as a dependency in your pubspec.yaml file. For example:

dependencies:
  contacts_plugin: '^0.0.3'

NOTE: There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. See issue Flutter#16049 for help on integration.

API

Fetch all contacts

To fetch all contacts from the address book make a call to the getContacts method:

import 'package:geolocator/contacts_plugin.dart';

List<Contact> contacts = await ContactsPlugin().getContacts();

Permissions

Android

On Android you'll need to add either the READ_CONTACTS or the WRITE_CONTACTS permissions to your Android Manifest (depending if you need read and/ or write access to the address book). Todo so open the AndroidManifest.xml file and one of the following two lines as direct children of the <manifest> tag:

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

iOS

On iOS you'll need to add the NSContactsUsageDescription to your Info.plist file in order to access the device's address book. Simply open your Info.plist file and add the following:

<key>NSContactsUsageDescription</key>
<string>This app needs access to address book.</string>

Issues

Please file any issues, bugs or feature request as an issue on our GitHub page.

Want to contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author

This Contacts plugin for Flutter is developed by Baseflow. You can contact us at hello@baseflow.com

Libraries

contacts_plugin

Dart

dart:ui
Built-in types and core primitives for a Flutter application. [...]

Core

dart:async
Support for asynchronous programming, with classes such as Future and Stream. [...]
dart:collection
Classes and utilities that supplement the collection support in dart:core. [...]
dart:convert
Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
dart:core
Built-in types, collections, and other core functionality for every Dart program. [...]
dart:developer
Interact with developer tools such as the debugger and inspector. [...]
dart:math
Mathematical constants and functions, plus a random number generator. [...]
dart:typed_data
Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]

VM

dart:io
File, socket, HTTP, and other I/O support for non-web applications. [...]
dart:isolate
Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]