Package-level declarations

Types

Link copied to clipboard
interface AnyHydratedBloc

Type-erased interface for HydratedBloc operations that need to work without knowledge of the concrete state and event type parameters.

Link copied to clipboard
abstract class Bloc<S : Any, E : Any>(initialState: S) : StateEmitter<S>

Business Logic Component — the core state-management class.

Link copied to clipboard
class BlocError(message: String, cause: Throwable? = null) : Exception

Generic error type for use with Cubit.addError / Bloc.addError when no domain-specific error type exists.

Link copied to clipboard
open class BlocObserver

Global observer that receives lifecycle notifications from every Bloc and Cubit in the app.

Link copied to clipboard

A centralised, type-safe registry for StateEmitter instances (both Bloc and Cubit).

Link copied to clipboard
data class Change<S : Any>(val currentState: S, val nextState: S)

Represents a state transition: the state before and after a single emit call.

Link copied to clipboard
abstract class Cubit<S : Any>(initialState: S) : StateEmitter<S>

A lightweight state-management class that exposes direct method calls instead of events.

Link copied to clipboard
sealed class EventTransformer

Controls how a new event of the same type is handled while a previous handler is still active or pending.

Link copied to clipboard
abstract class HydratedBloc<S : Any, E : Any>(initialState: S, serializer: KSerializer<S>, storageKeyParam: String? = null, storage: HydratedStorage = HydratedBloc.storage) : Bloc<S, E> , AnyHydratedBloc

A Bloc subclass that automatically persists its state to HydratedStorage on every emit and restores it the next time the Bloc is instantiated.

Link copied to clipboard
interface HydratedStorage

Persistence contract for HydratedBloc.

Link copied to clipboard

Thread-unsafe in-memory HydratedStorage for use in unit tests.

Link copied to clipboard
class SharedPreferencesStorage(context: Context, prefsName: String = "dev.bloc.hydrated") : HydratedStorage
Link copied to clipboard
interface StateEmitter<S : Any>

Base interface implemented by both Bloc and Cubit.

Link copied to clipboard
data class Transition<E : Any, S : Any>(val currentState: S, val event: E, val nextState: S)

A Change that also carries the event that triggered it.