BaiomySecureStorage class
A singleton wrapper around FlutterSecureStorage that provides typed
read / write / update / delete / clear operations with built-in error
handling.
All data is encrypted at rest using the platform's secure keychain (Keychain on iOS, Keystore on Android, libsecret on Linux).
Supported types: String, bool, int, double, and any
JSON-serialisable object via setObject / getObject.
Usage:
await BaiomySecureStorage.instance.setString('access_token', 'abc123');
final token = await BaiomySecureStorage.instance.getString('access_token');
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> -
Deletes ALL keys managed by
FlutterSecureStorage. -
containsKey(
String key) → Future< bool> -
Returns
trueifkeyexists in the secure store. -
getAll(
) → Future< Map< String, String> > - Returns all key–value pairs currently stored.
-
getBool(
String key, {bool? defaultValue}) → Future< bool?> -
Returns the stored bool, or
defaultValueif the key does not exist. -
getDouble(
String key, {double? defaultValue}) → Future< double?> -
Returns the stored double, or
defaultValueif the key does not exist. -
getInt(
String key, {int? defaultValue}) → Future< int?> -
Returns the stored int, or
defaultValueif the key does not exist. -
getKeys(
) → Future< Set< String> > - Returns all stored keys.
-
getObject(
String key) → Future< Map< String, dynamic> ?> -
Reads, decrypts, and decodes a JSON object stored under
key. -
getString(
String key, {String? defaultValue}) → Future< String?> -
Reads and returns the decrypted String stored under
key. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patchObject(
String key, Map< String, dynamic> patch) → Future<void> -
Updates an existing JSON object by merging
patchinto the stored value. -
remove(
String key) → Future< void> -
Removes and destroys the value stored under
key. -
removeMany(
List< String> keys) → Future<void> - Removes a list of keys in a single call.
-
setBool(
String key, {required bool value}) → Future< void> -
Encrypts and saves a bool value (stored as
"true"/"false"). -
setDouble(
String key, double value) → Future< void> - Encrypts and saves a double value.
-
setInt(
String key, int value) → Future< void> - Encrypts and saves an int value.
-
setObject(
String key, Map< String, dynamic> value) → Future<void> -
Serialises
valueto JSON, encrypts, and saves it underkey. -
setString(
String key, String value) → Future< void> -
Encrypts and saves a String value under
key. -
toString(
) → String -
A string representation of this object.
inherited
-
updateBool(
String key, {required bool newValue}) → Future< void> - Updates an existing bool key with a new value.
-
updateDouble(
String key, double newValue) → Future< void> - Updates an existing double key with a new value.
-
updateInt(
String key, int newValue) → Future< void> - Updates an existing int key with a new value.
-
updateString(
String key, String newValue) → Future< void> - Updates an existing String key with a new value.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → BaiomySecureStorage
-
The single instance of
SecureStorage.final