getContact method
Gets a specific contact by ID.
id
- The contact ID to retrieve.
withProperties
- Include phone numbers, emails, etc.
withThumbnail
- Include thumbnail image.
withPhoto
- Include full-size photo.
Implementation
@override
Future<Contact?> getContact(
String id, {
bool withProperties = true,
bool withThumbnail = false,
bool withPhoto = false,
}) async {
try {
final result = await methodChannel.invokeMethod<dynamic>(
'getContact',
{
'id': id,
'withProperties': withProperties,
'withThumbnail': withThumbnail,
'withPhoto': withPhoto,
},
);
return result != null ? Contact.fromJson(_safeMapCast(result)) : null;
} on PlatformException catch (e) {
throw Exception('Failed to get contact: ${e.message}');
}
}