toObservable

If a components implements the BlocObservableOwner interface it needs to provide

val observable: BlocObservable<State, SideEffect>

This extension functions converts a Bloc into that BlocObservable:

override val observable = bloc.toObservable()

The assumption is that all Blocs use the same BlocState with the same type parameters (enforced at compile time) but also that they share the same instance of a BlocState (not enforced at all). Under that assumption we only need to observe the state of the first Bloc to observe all state changes. The edge-case that one passes in multiple Blocs using different BlocStates could be covered by using a UUID for BlocState instances and then verify that all BlocStates have the same UUID but that would be over-engineering imo.


Same as above but combine just two Blocs to BlocObservable.