contacts_plugin_plus 0.0.4 copy "contacts_plugin_plus: ^0.0.4" to clipboard
contacts_plugin_plus: ^0.0.4 copied to clipboard

Contacts Flutter plugin.Support Android and iOS to select contacts and get all contacts

contacts_plugin #

支持Android和iOS端 #

获取联系人和选择联系人使用示例

选择联系人

  ContactsPlugin.selectContact().then((value) {
    // if (value != null) {
    //   var name = value["name"] ?? "";
    //   var number = value["number"] ?? "";
    var name = value.name ?? "";
    var number = value.number ?? "";
    setState(() {
      selectText = name + "/" + number;
    });
    // }
  });

获取全部联系人

  ContactsPlugin.getAllContacts().then((value) {
    for (var contact in value) {
      var number = "";
      if (contact.phones != null &&
          contact.phones!.isNotEmpty) {
        number = contact.phones?.first.value ?? "";
      }
      var name = contact.otherName ?? "";
      debugPrint("phone:" + number);
      debugPrint("name:" + name);
    }
    setState(() {
      allContacts = "The number of all contacts is:" +
          value.length.toString();
    });
  });
1
likes
140
points
69
downloads

Publisher

unverified uploader

Weekly Downloads

Contacts Flutter plugin.Support Android and iOS to select contacts and get all contacts

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on contacts_plugin_plus