showPicker method
Shows the native contact picker dialog. Returns the picked contact, or null if the user cancelled.
The picker itself is permissionless on both platforms. Calling without
properties always returns a Contact populated with id and
displayName.
Passing non-empty properties asks for additional fields:
- iOS: always works.
- Android: requires
READ_CONTACTS; throws a PlatformException otherwise.
Implementation
Future<Contact?> showPicker({Set<ContactProperty>? properties}) async {
final result = await _invoke<Map>('native.showPicker', {
'properties': (properties ?? ContactProperties.none).toJson(),
if (Platform.isIOS) 'enableIosNotes': ConfigApi.instance.enableIosNotes,
});
return JsonHelpers.decode(result, Contact.fromJson);
}