MrLiuYS / easy_contact_picker

联系人选择器,可以选择Native通讯录,也可以返回通讯录列表数据。支持iOS、Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

easy_contact_picker

A Flutter contact picker.Writted with pure dart, supported both iOS and Android.
Get address book permissions before using.

Use this package

Depend on it

    easy_contact_picker: ^0.0.2

Import it

import 'package:easy_contact_picker/easy_contact_picker.dart';

Add permission

Android

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

iOS

info.plist
Privacy - Contacts Usage Description
Tick the right box in the Background Modes Background fetch And Remote notification.

Sample

1.Open the Native address book.

Future<List<Contact>> selectContacts() async {
    final List result =
    await _channel.invokeMethod('selectContactList');
    if (result == null) {
      return null;
    }
    List<Contact> contacts = new List();
    result.forEach((f){
      contacts.add(new Contact.fromMap(f));
    });
    return contacts;
  }
2.Get contact list.
Future<Contact> selectContactWithNative() async {
    final Map<dynamic, dynamic> result =
    await _channel.invokeMethod('selectContactNative');
    if (result == null) {
      return null;
    }
    return new Contact.fromMap(result);
  }

About

联系人选择器,可以选择Native通讯录,也可以返回通讯录列表数据。支持iOS、Android

License:MIT License


Languages

Language:Dart 46.3%Language:Java 30.2%Language:Objective-C 20.1%Language:Ruby 3.5%