simple_storage_plugin
A plugin for storing data using shared preferences in Android. It is highly dependent on simple_signing_plugin
. Stored data is encrypted using AES. In order for the package to function properly, it is required to protect a device with a screen lock.
Features
This plugin contains following methods:
writeData
- saves user's input and key into shared preferences. Authentication is required to perform this action.readData
- reads data from shared preferences saved under input key. If no data under such key is present, an exception is thrown.deleteData
- deletes data from shared preferences saved under input key.editData
- edits data in shared preferences saved under input key. Authentication is required to perform this action.
Usage
//Writing data example
String _data = 'Data';
String _key = 'Key';
var result = await SimpleStoragePlugin.writeData(key, data); //returns true if everything goes fine. Can throw a SharedPreferencesException or DeviceNotSecuredException
//Reading data example
String _key = 'Key';
var result = await SimpleStoragePlugin.readData(readKeyController.text); //returns data written under key if everything goes fine. Can throw a InvalidSignatureException, DeviceNotSecuredException or NoKeyInStorageException
//Deleting data example
String _key = 'Key';
var result = await SimpleStoragePlugin.deleteData(readKeyController.text); //returns true if everything goes fine. Can throw a SharedPreferencesException or DeviceNotSecuredException
//Editing data example
String _data = 'Data';
String _key = 'Key';
var result = await SimpleStoragePlugin.editData(key, data); //returns true if everything goes fine. Can throw a SharedPreferencesException or DeviceNotSecuredException