Block screenshot and screen recording

Simple way to block Screenshot & screen recording for entire app. Tested working in Andriod and support iOS also.

STEP 1: Create custom actions.



STEP 2: Link to Main.dart


Dependencies: no_screenshot: ^0.0.1+6
                        : plugin_platform_interface: ^2.1.4

// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:no_screenshot/no_screenshot.dart';

final _noScreenshot = NoScreenshot.instance;

Future<void> screenshotsOff() async {
  await _noScreenshot.screenshotOff();
  // print('screenshots Off');
}

class ExampleScreen extends StatefulWidget {
  const ExampleScreen({Key? key}) : super(key: key);

  @override
  _ExampleScreenState createState() => _ExampleScreenState();
}

class _ExampleScreenState extends State<ExampleScreen> {
  @override
  void initState() {
    screenshotsOff();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(),
    );
  }
}

FYI it can also be used to block specific parts of screen but i have no requirement for that soo you play with it. Thanks to ChatGPT😂😜

4
8 replies