How to disable screenshots on Flutter
Mar 12, 2023
hello everyone today we will talk about how to disable screenshots on the Flutter app.
First of all, we are going to install the flutter_windowmanager package on pub.dev
flutter pub add flutter_windowmanager
warning: this package is for android app.
Integration
After installation, we must integrate like down below.
if (secureModeToggle == true) {
await FlutterWindowManager.addFlags(
FlutterWindowManager.FLAG_SECURE);
} else {
await FlutterWindowManager.clearFlags(
FlutterWindowManager.FLAG_SECURE);
}
if you want to disable the screenshot, you need to addFlags method with the FLAG_SECURE , if you want to remove this flag, you just need to use clearFlags method with the FLAG_SECURE.
☕ Buy me Coffee : https://buymeacoffee.com/yasindlklcc
Good work everyone.