Skip to content
pubscout

secure_shared_preferences

0.0.4, released 5 years ago by flutter.pingtobuild.com

Encrypt shared preferences on Android and UserDefaults on iOS using AES-CBC-128.

$ flutter pub add secure_shared_preferences
Source repository

What it does

A package to store and retrieve encrypted key-value data using shared preferences on Android and UserDefaults on iOS. It supports multiple data types including String, int, bool, double, map, and List<String>, using the AES-CBC-128 algorithm.

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

Use it when

  • You need to store sensitive key-value pairs securely on device
  • You want a familiar shared preferences interface with optional encryption

Skip it when

  • You require complex relational queries (use a database instead)
  • You need secure storage specifically relying exclusively on platform native secure storage without shared preferences wrappers

Strengths

  • Encrypts both keys and values using AES-CBC-128
  • Supports multiple data types including maps and lists
  • Allows bypassing encryption per entry via a boolean parameter

Weaknesses

  • Relies on older or mixed underlying dependencies like package_info
  • Limited documentation beyond basic read/write examples

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
5

Not documented

var pref = await SecureSharedPref.getInstance();
await pref.putString("StringEncrypted", "This is my first string test", isEncrypted: true);
String? val = await pref.getString("StringEncrypted", isEncrypted: true);

Alternatives

Packages that do the same job and could replace secure_shared_preferences.

Works with

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