Awesome Open Source
Awesome Open Source


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
  • libsecret is used for Linux.

Note KeyStore was introduced in Android 4.3 (API level 18). The plugin wouldn't work for earlier versions.

Getting Started

import 'package:flutter_secure_storage/flutter_secure_storage.dart';

// Create storage
final storage = new FlutterSecureStorage();

// Read value 
String value = await 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);

This allows us to be able to fetch secure values while the app is backgrounded, by specifying first_unlock or first_unlock_this_device. The default if not specified is unlocked. An example:

final options = IOSOptions(accessibility: IOSAccessibility.first_unlock);
await storage.write(key: key, value: value, iOptions: options);

Configure Android version

In [project]/android/app/build.gradle set minSdkVersion to >= 18.

android {
    defaultConfig {
        minSdkVersion 18


Note By default Android backups data on Google Drive. It can cause exception to unwrap key. You need to


You need libsecret-1-dev and libjsoncpp-dev on your machine to build the project, and libsecret-1-0 and libjsoncpp1 to run the application (add it as a dependency after packaging your app). If you using snapcraft to build the project use the following

    source: .
    plugin: flutter
    flutter-target: lib/main.dart 
     - libsecret-1-dev
     - libjsoncpp-dev
     - libsecret-1-dev
     - libjsoncpp1-dev

Integration Tests

Run the following command from example directory

flutter drive --target=test_driver/app.dart
Alternatives To Flutter_secure_storage
Select To Compare

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Plugin (113,340
Dart (62,483
Flutter (32,113
Flutter Plugin (1,031
Dartlang (841