flutter_secure_storage 3.2.0

  • README.md
  • Example
  • Installing
  • Versions
  • 98

flutter_secure_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.

Getting Started #

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

// 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);

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 java.security.InvalidKeyException:Failed to unwrap key. You need to disable backup to fix this issue. https://github.com/mogol/flutter_secure_storage/issues/13#issuecomment-421083742


  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library. Thanks I-am-original.
  • Enable StrongBox on Android devices that support it. Thanks bbedward.


  • Fix Android 9.0 Pie KeyStore exception. Thanks hacker1024


  • Added recreating secretKey if its decoding failed. Fix for unwrap key. Thanks hnvn.


  • Suppress warning about unchecked operations when compiling for Android.


  • Added readAll and deleteAll.


  • Breaking change. Changed payloads encryption for Android from RSA to AES, AES secret key is encrypted with RSA.


  • Breaking change. Changed key alias to fix Android 4.4.2 issue. The plugin isn't able to get previous stored data.


  • Bump version


  • Initial release


flutter_secure_storage_example #

Demonstrates how to use the flutter_secure_storage plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_secure_storage: ^3.2.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_secure_storage/flutter_secure_storage.dart';
Version Uploaded Documentation Archive
3.2.0 Feb 14, 2019 Go to the documentation of flutter_secure_storage 3.2.0 Download flutter_secure_storage 3.2.0 archive
3.1.3 Jan 21, 2019 Go to the documentation of flutter_secure_storage 3.1.3 Download flutter_secure_storage 3.1.3 archive
3.1.2 Sep 21, 2018 Go to the documentation of flutter_secure_storage 3.1.2 Download flutter_secure_storage 3.1.2 archive
3.1.1 Jul 16, 2018 Go to the documentation of flutter_secure_storage 3.1.1 Download flutter_secure_storage 3.1.1 archive
3.1.0 May 19, 2018 Go to the documentation of flutter_secure_storage 3.1.0 Download flutter_secure_storage 3.1.0 archive
3.0.0 Apr 14, 2018 Go to the documentation of flutter_secure_storage 3.0.0 Download flutter_secure_storage 3.0.0 archive
2.0.0 Mar 1, 2018 Go to the documentation of flutter_secure_storage 2.0.0 Download flutter_secure_storage 2.0.0 archive
1.0.0 Feb 8, 2018 Go to the documentation of flutter_secure_storage 1.0.0 Download flutter_secure_storage 1.0.0 archive
0.0.1 Oct 31, 2017 Go to the documentation of flutter_secure_storage 0.0.1 Download flutter_secure_storage 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13
  • Flutter: 1.2.0


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

8 out of 8 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
meta ^1.1.2 1.1.6 1.1.7
Transitive dependencies
collection 1.14.11
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8