getContact static method

Future<Contact?> getContact(
  1. String id, {
  2. bool withProperties = true,
  3. bool withThumbnail = true,
  4. bool withPhoto = true,
  5. bool deduplicateProperties = true,
})

Fetches one contact.

By default everything available is fetched. If withProperties is false, properties (phones, emails, addresses, websites, etc) won't be fetched.

If withThumbnail is false, the low-resolution thumbnail won't be fetched. If withPhoto is false, the high-resolution photo won't be fetched.

If deduplicateProperties is true, the properties will be de-duplicated, mainly to avoid the case (common on Android) where multiple equivalent phones are returned.

Implementation

static Future<Contact?> getContact(
  String id, {
  bool withProperties = true,
  bool withThumbnail = true,
  bool withPhoto = true,
  bool deduplicateProperties = true,
}) async {
  final contacts = await _select(
    id: id,
    withProperties: withProperties,
    withThumbnail: withThumbnail,
    withPhoto: withPhoto,
    sorted: false,
    deduplicateProperties: deduplicateProperties,
  );
  if (contacts.length != 1) return null;
  return contacts.first;
}