Last updated:
0 purchases
secure shared preferences
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 #
add dependency in pubspec.yaml file secure_shared_preferences:0.0.4
add import import 'package:secure_shared_preferences/secure_shared_preferences.dart';
Usage #
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);
copied to clipboard
To get string data type to secure storage.
var pref = await SecureSharedPref.getInstance();
pref.getString("Key", isEncrypted : true);
copied to clipboard
Additional information #
Encryption flow chart
Usage
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);
copied to clipboard
First parameter is the 'key'
Second parameter is the value
Third parameter is whether you want to encrypt this key/value or not.
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);
copied to clipboard
First parameter is the 'key'
Second parameter is whether you have encrypted this key/value or not.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.