screenshot_callback 1.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 81

Screenshot Callback

Flutter plugin that allows you to detect mobile screenshot and execute callback functions on iOS and Android. 🚀

UsageIssues and FeedbackAuthorLicense

Feedback welcome and Pull Requests are most welcome!

Usage #

Import the package #

To use this plugin, follow the plugin installation instructions.

Use the plugin #

Add the following import to your Dart code:

import 'package:screenshot_callback/screenshot_callback.dart';

Initialize ScreenshotCallback with the scopes you want:

ScreenshotCallback screenshotCallback = ScreenshotCallback();

addListener #

Then invoke addListener method of ScreenshotCallback. Add custom functions that you want to excute after detect screenshot. e.g:

screenshotCallback.addListener(() {
  //Void funtions are implemented
  print('detect screenshot');

dispose #

You need to call dispose method to terminate ScreenshotCallback before you exit the app e.g:


Issues and Feedback #

Please file issues to send feedback or report a bug. Thank you !

Author #

License #


1.1.1 #

  • ios: Keep only one single observer

1.1.0 #

  • Added optional requestPermissions parameter.
  • Update permission_handler to 4.0.0.
  • Update Gradle, Android Studio plugin versions.
  • Bump compileSdkVersion to 29.
  • Enable R8, AndroidX, Jetifier.
  • Bump Dart version to 2.7.0.
  • Fixes #17.
  • Fixes #18.

1.0.1 #

  • Import permission_handler package.

1.0.0 #

  • Update to add Android integration guide. (READ_EXTERNAL_STORAGE permission)

0.1.0 #

  • Fix several Android phone's screenshot callback detect path.

0.0.2 #

  • Update

0.0.1 #

  • Update example (add permission plugin to access external storage in Android).

0.0.1-alpha0 #

Enable screenshot detection on iOS and Android! 😀


import 'package:flutter/material.dart';
import 'package:screenshot_callback/screenshot_callback.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  ScreenshotCallback screenshotCallback;

  String text = "Ready..";

  void initState() {


  void init() async {
    await initScreenshotCallback();


  //It must be created after permission is granted.
  Future<void> initScreenshotCallback() async {
    screenshotCallback = ScreenshotCallback();

    screenshotCallback.addListener(() {
      setState(() {
        text = "Screenshot callback Fired!";

    screenshotCallback.addListener(() {
      print("We can add multiple listeners ");

  void dispose() {

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Detect Screenshot Callback Example'),
        body: Center(
          child: Text(text,
              style: TextStyle(
                fontWeight: FontWeight.bold,

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  screenshot_callback: ^1.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:screenshot_callback/screenshot_callback.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/screenshot_callback.dart.

Run flutter format to format lib/screenshot_callback.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (permission_handler).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
permission_handler ^4.0.0 4.4.0+hotfix.4 5.0.0+hotfix.3
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
permission_handler_platform_interface 1.0.0 2.0.0
plugin_platform_interface 1.0.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies