HydratedStorage

interface HydratedStorage

Persistence contract for HydratedBloc.

The interface is intentionally minimal and KMP-ready — no Android types are imported. Implementations provide the platform-specific storage backend:

// Use the built-in Android implementation
HydratedBloc.storage = SharedPreferencesStorage(context)

// Swap in a test double
HydratedBloc.storage = InMemoryStorage()

Inheritors

Functions

Link copied to clipboard
abstract fun clear()

Removes all entries managed by this storage.

Link copied to clipboard
abstract fun delete(key: String)

Removes the entry for key. No-op if the key does not exist.

Link copied to clipboard
abstract fun read(key: String): ByteArray?

Returns the raw bytes stored under key, or null if absent.

Link copied to clipboard
abstract fun write(key: String, value: ByteArray)

Persists value under key, overwriting any previous entry.