Docs
Security: Vault
Introduction
The Vault facade provides a simple interface for securely storing sensitive data on the device. It uses the platform's native secure storage mechanisms:
- iOS: Keychain
- Android: EncryptedSharedPreferences
- macOS: Keychain
- Windows: Windows Credential Locker
Storing Items
To store a value in the vault:
await Vault.put('api_token', 'super-secret-token');
Retrieving Items
To retrieve a value:
final token = await Vault.get('api_token');
if (token != null) {
// Use token...
}
Removing Items
To remove a specific item:
await Vault.delete('api_token');
To wipe all data from the vault (use with caution):
await Vault.flush();