privacy_mask 1.0.1
privacy_mask: ^1.0.1 copied to clipboard
A lightweight Flutter widget to protect sensitive content by preventing screenshots and screen recording at the OS level on Android and iOS.
Privacy Mask 🛡️ #
A lightweight, high-performance Flutter widget that protects sensitive information by preventing screen recording and screenshots at the OS level.
🌟 Why Privacy Mask? #
In 2025, mobile security is more than a feature—it's a requirement. Whether you're building a Banking, Healthcare (HIPAA), or Private Messaging app, privacy_mask ensures that sensitive data stays on the user's screen and out of their camera roll.
- Android Support: Uses
FLAG_SECUREto block screenshots and screen recordings system-wide. - iOS Support: Utilizes a secure layer hack (
isSecureTextEntry) to black out recordings and screenshots. - Lifecycle Aware: Automatically enables/disables protection as the widget enters or leaves the screen.
📸 See it in action #
Protection States #
You can toggle protection dynamically. When enabled, the OS prevents the UI from being captured in the screen buffer.
| Protection Disabled | Protection Enabled |
|---|---|
![]() |
![]() |
| App behaves normally | Ready for sensitive data |
Screenshot Prevention #
When a user attempts to take a screenshot or record the screen while protection is active, the OS intercepts the action.
| Result of Screenshot/Recording |
|---|
![]() |
| Android records a black screen/ iOS shows a security error |
⚠️ Warning #
Note on Testing: Screenshot prevention is a hardware-level feature. It will not work on the iOS Simulator because the Simulator bypasses the iOS Render Server. To verify iOS protection, you must use a physical device and test using Screen Recording or Screen Mirroring.
🚀 Getting Started #
Add the dependency to your pubspec.yaml:
dependencies:
privacy_mask: ^1.0.1


