getContact static method

Future<Contact?> getContact(
  1. String contactId, {
  2. List<ContactField> fields = ContactField.values,
})

Returns data of a contact with the given contactId.

fields is a list of fields to fetch. Less fields means faster loading. By default, all fields are fetched.

Implementation

static Future<Contact?> getContact(
  String contactId, {
  List<ContactField> fields = ContactField.values,
}) async {
  final result = await _channel.invokeMethod('getContact', {
    'id': contactId,
    'fields': fields.map((e) => e.name).toList(),
  });
  if (result == null) return null;
  return Contact.fromMap(result);
}