Last updated:
0 purchases
flutter secured storage
flutter_secured_storage #
A Flutter plugin to store data in secure storage:
Keychain is used for iOS
AES encryption is used for Android. AES secret key is encrypted with RSA and RSA key is stored in KeyStore
Note KeyStore was introduced in Android 4.3 (API level 18). The plugin wouldn't work for earlier versions.
How to install #
Add to your pubspec.yaml
dependencies:
flutter_secured_storage: ^1.0.4
copied to clipboard
Getting Started #
import 'package:flutter_secured_storage/flutter_secured_storage.dart';
// Create storage
final storage = new FlutterSecuredStorage();
// Read value
String value = await storage.read(key: key);
// Read all values
Map<String, String> allValues = await storage.readAll();
// Delete value
await storage.delete(key: key);
// Delete all
await storage.deleteAll();
// Write value
await storage.write(key: key, value: value);
copied to clipboard
Configure Android version #
In [project]/android/app/build.gradle set minSdkVersion to >= 18.
android {
...
defaultConfig {
...
minSdkVersion 18
...
}
}
copied to clipboard
Note By default Android backups data on Google Drive. It can cause exception java.security.InvalidKeyException:Failed to unwrap key.
You need to
disable autobackup, details
exclude sharedprefs FlutterSecuredStorage used by the plugin, details
Integration Tests #
Run the following command from example directory
flutter drive --target=test_driver/app.dart
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.