flutter_prevent_screenshot 0.0.1+16
flutter_prevent_screenshot: ^0.0.1+16 copied to clipboard
flutter_prevent_screenshot prevents screenshots and screen recordings in Flutter apps on Android and iOS, ideal for protecting sensitive or confidential information.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_prevent_screenshot/disablescreenshot.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _flutterPreventScreenshot = FlutterPreventScreenshot.instance;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
child: const Text('Press to toggle screenshot'),
onPressed: () async {
final result = await _flutterPreventScreenshot.toggleScreenshot();
print(result);
},
),
ElevatedButton(
child: const Text('Press to turn off screenshot'),
onPressed: () async {
final result = await _flutterPreventScreenshot.screenshotOff();
print(result);
},
),
ElevatedButton(
child: const Text('Press to turn on screenshot'),
onPressed: () async {
final result = await _flutterPreventScreenshot.screenshotOn();
print(result);
},
),
],
)),
),
);
}
}