You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with a Cubit that consume some other Stream you need to maintain a StreamSubscription during the life of the Cubit and close it etc. This comes with some extra work which is handled well in Bloc via emit.forEach / emit.onEach but no similar solution exists for that when using Cubit.
Desired Solution
Adding the methods emitForEach and emitOnEach with same signatures and functionality as their counter part in Emitter.
Alternatives Considered
Maybe give a Cubit its own Emitter.
The text was updated successfully, but these errors were encountered:
I think the alternative solution you proposed of exposing an Emitter would be better, as it would give a more consistent experience between Bloc and Cubit.
It would be even cooler if the Emitter is returned by an emit property, replacing the emit(State) method.
It would be a breaking change, not sure how big a breaking change though, as the main usage of emit (just calling emit(newState)) would still work as intended.
Description
When working with a
Cubit
that consume some otherStream
you need to maintain aStreamSubscription
during the life of theCubit
and close it etc. This comes with some extra work which is handled well inBloc
viaemit.forEach
/emit.onEach
but no similar solution exists for that when usingCubit
.Desired Solution
Adding the methods
emitForEach
andemitOnEach
with same signatures and functionality as their counter part inEmitter
.Alternatives Considered
Maybe give a
Cubit
its ownEmitter
.The text was updated successfully, but these errors were encountered: