secure_store_plugin 0.0.3
secure_store_plugin: ^0.0.3 copied to clipboard
This is a plugin for storing data with high security.
Hereβs a good starting README.md for your SecureStorePlugin in English:
# SecureStorePlugin
A Flutter plugin for storing data with **high-level security** on both Android and iOS.
---
## Features
- π Secure key-value storage
- β
Supports primitive types (`String`, `int`, `bool`, `double`)
- β
Supports `Map<String, dynamic>` and `List<dynamic>`
- β
Custom object support via `toJson` / `fromJson`
- π± Works on **Android** (Keystore / EncryptedSharedPreferences) and **iOS** (Keychain)
- β‘ Fast and easy-to-use API
---
## Installation
Run this command:
flutter pub add secure_store_plugin
or
Add the dependency in your `pubspec.yaml`:
```yaml
dependencies:
secure_store_plugin: ^0.0.1
Run:
flutter pub get
Usage #
Writing and reading primitive values #
await SecureStorePlugin.write<String>('token', 'abc123');
final token = await SecureStorePlugin.read<String>('token');
Writing and reading custom objects #
class User {
final int id;
final String name;
const User({required this.id, required this.name});
factory User.fromJson(Map<String, dynamic> json) =>
User(id: json['id'], name: json['name']);
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
};
}
// Store object
await SecureStorePlugin.write(
'user',
User(id: 1, name: 'Hung Nguyen').toJson(),
);
// Read object
final userJson = await SecureStorePlugin.read<Map<String, dynamic>>('user');
if (userJson != null) {
final user = User.fromJson(userJson);
}
API #
Future<void> write<T>(String key, T value) #
Stores a value securely.
Future<T?> read<T>(String key) #
Reads a value securely. Returns null if the key does not exist.
Future<void> delete(String key) #
Deletes the value associated with the key.
Future<void> clear() #
Clears all stored values.
Security #
- Android: Uses Keystore and
EncryptedSharedPreferences - iOS: Uses Keychain
β οΈ This plugin is completely free. Do not copy, clone, or redistribute under any circumstances.
License #
MIT