pickContacts method
Future<List<PickedContact> >
pickContacts({
- required Set<
ContactField> fields, - required bool allowMultiple,
- required int? limit,
- required bool matchAllFields,
override
Opens the platform contact picker with the requested options.
Implementation
@override
Future<List<PickedContact>> pickContacts({
required Set<ContactField> fields,
required bool allowMultiple,
required int? limit,
required bool matchAllFields,
}) async {
final contacts = await methodChannel
.invokeListMethod<dynamic>('pickContacts', <String, Object?>{
'fields': fields.map((field) => field.name).toList(growable: false),
'allowMultiple': allowMultiple,
'limit': limit,
'matchAllFields': matchAllFields,
});
return (contacts ?? const <dynamic>[])
.whereType<Map<dynamic, dynamic>>()
.map(PickedContact.fromMap)
.toList(growable: false);
}