SecretStore class
App-facing convenience over SecureStoragePort: typed accessors for the two shapes every caller stores — tokens (String) and arbitrary JSON maps — plus raw map access.
final secrets = SecretStore();
await secrets.saveToken('auth', 'tok-1');
await secrets.readToken('auth'); // 'tok-1'
Constructors
- SecretStore({SecureStoragePort? storage})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- storage → SecureStoragePort
-
The storage backend (in-memory default; inject a platform adapter).
final
Methods
-
clear(
) → Future< void> - Clears every entry.
-
contains(
String key) → Future< bool> -
Whether
keyexists. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String key) → Future< Map< String, dynamic> ?> -
Reads a raw JSON map;
nullwhen absent. -
readObject<
T> (String key, T fromJson(Map< String, dynamic> )) → Future<T?> -
Reads a typed entry under
keyviafromJson;nullwhen absent. -
readToken(
String key) → Future< String?> -
Reads the token under
key, ornullwhen absent. -
remove(
String key) → Future< bool> -
Removes
key; returns whether an entry was removed. -
saveObject<
T> (String key, T value, Map< String, dynamic> toJson(T)) → Future<void> -
Saves a typed entry under
keyvia itstoJson. -
saveToken(
String key, String token) → Future< void> -
Saves an opaque token string under
key. -
toString(
) → String -
A string representation of this object.
inherited
-
write(
String key, Map< String, dynamic> value) → Future<void> -
Writes a raw JSON map under
key.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited