0 purchases
contacts plugin plus
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;
});
// }
});
copied to clipboard
获取全部联系人
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();
});
});
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.