getContactPhoto method

  1. @override
Future<void> getContactPhoto(
  1. String id,
  2. ContactPhotoSuccessCallback onSuccess,
  3. ContactPhotoErrorCallback onError
)
override

Fetches a contact photo by contact identifier.

Implementation

@override
Future<void> getContactPhoto(String id, ContactPhotoSuccessCallback onSuccess,
    ContactPhotoErrorCallback onError) async {
  try {
    final image = await fc.FastContacts.getContactImage(id);
    if (image != null) {
      onSuccess(image);
    } else {
      onError('Failed to fetch contact photo - ContactID: $id');
    }
  } catch (e) {
    onError('Failed to fetch contact photo - Reason: $e');
  }
}