Hydrated Storage
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:
Android: SharedPreferencesStorage (bundled in the
:blocmodule)Tests: InMemoryStorage
KMP: supply a
settings-based or SQLite implementation in each target'sactual
// Use the built-in Android implementation
HydratedBloc.storage = SharedPreferencesStorage(context)
// Swap in a test double
HydratedBloc.storage = InMemoryStorage()Content copied to clipboard