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 key exists.
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; null when absent.
readObject<T>(String key, T fromJson(Map<String, dynamic>)) Future<T?>
Reads a typed entry under key via fromJson; null when absent.
readToken(String key) Future<String?>
Reads the token under key, or null when 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 key via its toJson.
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