flutter-secure-storagelisted
Install: claude install-skill noory-code/noory-ai
# Flutter Secure Storage
Encrypted storage backed by iOS Keychain and Android Keystore. Use it to store sensitive data.
---
## Installation
```bash
flutter pub add flutter_secure_storage
```
## Platform Setup
### Android (android/app/build.gradle)
```groovy
android {
defaultConfig {
minSdkVersion 18 // minimum API 18
}
}
```
### iOS (ios/Runner/Info.plist) — optional
```xml
<!-- to preserve data after app deletion -->
<key>SecAttrAccessible</key>
<string>kSecAttrAccessibleAfterFirstUnlock</string>
```
---
## Quick Reference
### Basic Usage
```dart
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
const storage = FlutterSecureStorage();
// write
await storage.write(key: 'access_token', value: 'abc123');
await storage.write(key: 'refresh_token', value: 'xyz789');
// read
final token = await storage.read(key: 'access_token');
// delete
await storage.delete(key: 'access_token');
// delete all
await storage.deleteAll();
// read all keys
final allKeys = await storage.readAll();
```
### Android Options (EncryptedSharedPreferences)
```dart
const storage = FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true, // recommended for API 23+
),
);
```
### iOS Options
```dart
const storage = FlutterSecureStorage(
iOptions: IOSOptions(
accessibility: KeychainAccessibility.first_unlock,
// to retain data after app reinstall:
// accessibility: KeychainAccessibility.first_unlock_this_dev