Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add emitForEach / emitOnEach Methods (or something similar) to Cubit #3555

Open
jtdLab opened this issue Sep 27, 2022 · 2 comments
Open
Labels
enhancement candidate Candidate for enhancement but additional research is needed

Comments

@jtdLab
Copy link

jtdLab commented Sep 27, 2022

Description

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.

@jyardin
Copy link

jyardin commented Mar 10, 2023

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.

@felangel felangel added the enhancement candidate Candidate for enhancement but additional research is needed label Apr 15, 2023
@vgtle
Copy link

vgtle commented Aug 14, 2023

This would be a great feature. Are there any plans of implementing this? Or any ways to contribute to this?

@jtdLab jtdLab mentioned this issue Aug 15, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement candidate Candidate for enhancement but additional research is needed
Projects
None yet
Development

No branches or pull requests

4 participants