checkPermission method
Check current screen recording permission status.
Implementation
Future<BackgroundCapturePermission> checkPermission() async {
try {
final result = await _channel.invokeMethod<String>('backgroundCapture.checkPermission');
switch (result) {
case 'granted':
return BackgroundCapturePermission.granted;
case 'denied':
return BackgroundCapturePermission.denied;
case 'restricted':
return BackgroundCapturePermission.restricted;
default:
return BackgroundCapturePermission.notDetermined;
}
} on PlatformException catch (e) {
_eventController.add(BackgroundCaptureEvent(
paletteId: '',
type: 'error',
data: {'error': e.message ?? 'Unknown error'},
));
return BackgroundCapturePermission.notDetermined;
}
}