How to prevent screen capturing & recording in Flutter application.

Learn to prevent screen capturing & recording in your Flutter app.

· 1 min read
How to prevent screen capturing & recording in Flutter application.

Hello everyone, In this article, I am going to discuss, how you can prevent screen capturing & recording on your Flutter app.

To implement this functionality we are going to use flutter_forbidshot plugin.

Plugin Installation

Add this plugin to your pubspec.yaml file.

flutter_forbidshot: ^0.0.2

Usage

Android

  1. To turn on the screen protection
FlutterForbidshot.setAndroidForbidOn();

2. To turn off the screen protection

FlutterForbidshot.setAndroidForbidOff();

iOS

On iOS, you can use an event listener to know when the screen capturing or recording is started.

StreamSubscription<void> subscription = FlutterForbidshot.iosShotChange.listen((event) {});

It also provides a method for iOS to check if the screen is captured or not

bool isCapture = await FlutterForbidshot.iosIsCaptured;

You can use the above code for iOS to do the suitable thing when the screen is being captured in iOS.

flutter_forbidshot | Flutter Package
A new Flutter plugin.

I hope you have found this article informative, If you have any other problems you can ask me in the comment section.

Related Articles

How to take screenshot in Flutter
· 2 min read
Flutter Localization Tutorial
· 5 min read