Skip to content
pubscout

privacy_screen

0.0.8, released 2 years ago by eddyuan.com

Hides sensitive data in the app switcher and provides automatic lock triggers with native lifeCycle listeners.

WASM-ready
$ flutter pub add privacy_screen
Source repository

What it does

A Flutter plugin that hides sensitive app data using privacy screens on iOS and FLAG_SECURE on Android when the app enters the background. It also provides automatic app locking mechanisms via native lifecycle listeners.

AI-written summary of version 0.0.8, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to hide sensitive content when the app is in the background or app switcher.
  • You want to implement an automatic lock screen triggered by native lifecycle events after a set duration.

Skip it when

  • You need a package that is actively maintained, as this plugin is unmaintained.
  • You require custom privacy views on Android (Android forces a black/white screen via FLAG_SECURE).

Strengths

  • Uses native app lifecycles instead of Flutter's to ensure proper behavior when entering native views.
  • Supports custom privacy images and blur effects on iOS.
  • Provides a native lifecycle events stream and customizable lock gates.

Weaknesses

  • The plugin is explicitly marked as no longer maintained.
  • Android does not support custom privacy views and disables screenshots globally when enabled.
  • Lock screens cannot be presented on top of active native views on iOS.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
1

Requires adding privacy_screen to pubspec.yaml and configuring native assets (like LaunchImage on iOS) if custom images are desired.

bool result = await PrivacyScreen.instance.enable(
    iosOptions: const PrivacyIosOptions(
        enablePrivacy: true,
        privacyImageName: "LaunchImage",
        autoLockAfterSeconds: 5,
        lockTrigger: IosLockTrigger.didEnterBackground,
    ),
    androidOptions: const PrivacyAndroidOptions(
        enableSecure: true,
        autoLockAfterSeconds: 5,
    ),
    backgroundColor: Colors.white,
    blurEffect: PrivacyBlurEffect.extraLight,
);

Alternatives

Packages that do the same job and could replace privacy_screen.

Works with

Packages commonly used together with privacy_screen: ones it builds on, ones built on it, and its own family.