hybrid_prefs 1.0.0
hybrid_prefs: ^1.0.0 copied to clipboard
Type-safe SharedPreferences with synchronous reads, where secure keys (tokens, secrets) live in the Keychain/Keystore and are migrated out of plaintext automatically.
1.0.0 #
First release.
- Typed keys:
PrefKey<T>for SharedPreferences andSecureKey<T>for the Keychain / Keystore. A non-nullable key without a default is a compile-time error. - Synchronous
getfor every key, secure ones included. Secure values are loaded once byHybridPrefs.init. String,bool,int,doubleandList<String>work out of the box, withJsonKeyCodec,EnumKeyCodec,DateTimeKeyCodecor your ownKeyCodecfor anything else.- Automatic migration of plaintext values of secure keys. The plaintext copy is removed only after the secure write succeeds.
- Fails safe: failed secure writes throw and roll back unless
allowPlaintextFallbackis on. Unreadable values return the key's default. clearSecureOnReinstallstops iOS reinstalls from inheriting the previous install's Keychain entries.onErrorreports every secure-storage and decode failure.- Pluggable
SecureStorebackend for tests and custom storage.