secure_shared_preferences 0.0.4 copy "secure_shared_preferences: ^0.0.4" to clipboard
secure_shared_preferences: ^0.0.4 copied to clipboard

Simple to use yet powerful package to encypt shared preferences in android and UserDefaults in iOS.

Encryption is important

pub points Pub

Features #

  • Simple to use yet powerful package to encypt shared preferences in android and UserDefaults in iOS.
  • You have an option to by pass encryption just by passing a bool.
  • Supports String, int, bool, double, map and List<String>.
  • Uses advance AES-CBC-128 algorithm for encryption.
  • Encrypts both key and value.
  • Integration unit tests available here

Getting started #

  1. add dependency in pubspec.yaml file secure_shared_preferences:0.0.4
  2. add import import 'package:secure_shared_preferences/secure_shared_preferences.dart';

Usage #

  1. To save string data type to secure storage.
    var pref = await SecureSharedPref.getInstance();
    pref.putString("Key", "This is data I want to save to local storage", isEncrypted : true);
  1. To get string data type to secure storage.
    var pref = await SecureSharedPref.getInstance();
    pref.getString("Key", isEncrypted : true);

Additional information #

Encryption flow chart

FlowChart

Usage

  1. Save :
    var pref = await SecureSharedPref.getInstance();
    await pref.putString("StringEncrypted", "This is my first string test",isEncrypted: true);
    await pref.putInt("key", 100, isEncrypted: true);
    await pref.putMap("mapKey", {"Hello":true}, isEncrypted: true);
    await pref.putDouble("doubleKey", 20.32, isEncrypted: true);
    await pref.putBool("boolKey", true,isEncrypted:  true);
    await pref.putStringList("listKey", ["S","K"], isEncrypted: true);

First parameter is the 'key' Second parameter is the value Third parameter is whether you want to encrypt this key/value or not.

  1. Fetch :
    var pref = await SecureSharedPref.getInstance();
    await pref.getString("StringEncrypted", isEncrypted: true);
    await pref.getInt("key", isEncrypted: true);
    await pref.getMap("mapKey", isEncrypted: true);
    await pref.getDouble("doubleKey", isEncrypted: true);
    await pref.getBool("boolKey",isEncrypted: true);
    await pref.getStringList("listKey", isEncrypted: true);

First parameter is the 'key' Second parameter is whether you have encrypted this key/value or not.

23
likes
120
pub points
91%
popularity

Publisher

verified publisherflutter.pingtobuild.com

Simple to use yet powerful package to encypt shared preferences in android and UserDefaults in iOS.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

cryptography, cryptography_flutter, flutter, flutter_secure_storage, package_info, shared_preferences

More

Packages that depend on secure_shared_preferences