A flutter plugin for ios to listen to and check the screen recording status.
Platforms | iOS |
---|---|
Support | 12.0+ |
Add the flutter_prevent_screen_capture
plugin to your
pubspec dependencies.
void initState() {
///Though listening to the screen record, it is recommended to check the screen record status on the first launch.
checkScreenRecord();
///Initialize screenRecordSubscription to regularly listen to the changes
_screenRecordsSubscription =
preventScreenCapture.screenRecordsIOS.listen(updateRecordStatus);
super.initState();
}
///Cancel the subscription when the widget is disposed
@override
dispose() {
_screenRecordsSubscription.cancel();
super.dispose();
}
Future<void> checkScreenRecord() async {
final recordStatus = await preventScreenCapture.checkScreenRecord();
debugPrint('Is screen being recorded: $recordStatus');
isRecording = recordStatus;
setState(() {});
}
Currently this plugin supports only ios.
No, the plugin works only in real devices!