requestPermission method
Requests permission to access contacts.
readOnly
- If true, requests read-only permission.
Implementation
@override
Future<PermissionStatus> requestPermission({bool readOnly = false}) async {
try {
final result = await methodChannel.invokeMethod<String>(
'requestPermission',
{'readOnly': readOnly},
);
return _parsePermissionStatus(result);
} on PlatformException catch (e) {
final errorDetails =
e.details?.toString() ?? e.message ?? 'Unknown error';
throw Exception('Failed to request permission: $errorDetails');
}
}