ss_preventer 0.1.2 copy "ss_preventer: ^0.1.2" to clipboard
ss_preventer: ^0.1.2 copied to clipboard

Flutter plugin for screenshot prevention and screenshot detection stream on Android/iOS.

ss_preventer #

Flutter plugin for screenshot prevention and screenshot detection stream.

Features #

  • preventOn: enable screenshot prevention.
  • preventOff: disable screenshot prevention.
  • setDetectionEnabled: enable/disable screenshot detection callbacks.
  • screenshotStream: stream event when screenshot is detected.

Platform support #

  • Android
    • preventOn / preventOff: supported (uses FLAG_SECURE).
    • screenshotStream: Android 14+ only (uses registerScreenCaptureCallback).
  • iOS
    • preventOn / preventOff: supported.
    • screenshotStream: supported (UIApplication.userDidTakeScreenshotNotification).

Installation #

Add dependency:

dependencies:
  ss_preventer: ^0.1.2

iOS Swift Package Manager #

  • Swift Package Manager metadata is included for iOS.
  • Flutter projects using this plugin with SPM need Flutter 3.41 or later.
  • CocoaPods remains supported as a fallback.

Android permission (app side) #

To use screenshot detection on Android 14+, add this permission in your app's AndroidManifest.xml:

<uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE" />

Usage #

import 'dart:async';

import 'package:ss_preventer/ss_preventer.dart';

StreamSubscription? subscription;

Future<void> startProtection() async {
  await SsPreventer.preventOn();
  await SsPreventer.setDetectionEnabled(true);

  subscription = SsPreventer.screenshotStream.listen((event) {
    // Handle screenshot detection.
    print('Screenshot detected at: ${event.detectedAt}');
  });
}

Future<void> stopProtection() async {
  await SsPreventer.preventOff();
  await SsPreventer.setDetectionEnabled(false);
  await subscription?.cancel();
}

iOS implementation note #

This plugin follows Flutter's UISceneDelegate migration guidance for plugins and uses scene/application lifecycle registration.

Native iOS sources are packaged for both CocoaPods and Swift Package Manager.

Reference:

Example #

See /example for a full sample app.

Publishing #

See PUBLISHING.md.

License #

See LICENSE.

0
likes
150
points
0
downloads

Publisher

verified publisherdl10yr.com

Weekly Downloads

Flutter plugin for screenshot prevention and screenshot detection stream on Android/iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on ss_preventer

Packages that implement ss_preventer