Bloc: [proposal] Wouldn't be better to expose both cubit & bloc instead of `cubit` for BlocListener, BlocBuilder & BlocConsumer?

Created on 24 Nov 2020  路  3Comments  路  Source: felangel/bloc

Is your feature request related to a problem? Please describe.
In v7 we are seeing a new breaking change which will be to move away from cubit: in BlocListener ,*Consumer , *Builder and use value instead.

I found value to not be very good name for expressing the intent in this context.

Describe the solution you'd like

My proposed solution will be to have an API which expose both cubit and bloc and getting both optionally but mutually exclusive in the constructor logic.

This might not be the best of the user experience therefore i would like to have a chat about it.

Describe alternatives you've considered

Another consideration could be to find a better name instead of value

discussion feedback wanted

Most helpful comment

value is the closest name to existing APIs so it's the best option like @felangel pointed out.

All 3 comments

Hi @nerder 馃憢
Thanks for opening an issue!

The goal of the name value is to align with existing APIs that developers will likely already be familiar with (BlocProvider.value, Provider.value, etc...). I have considered the approach of having a cubit and bloc parameter but it feels weird because it would serve no purpose beside to give developers two different names for the same argument.

I'm always happy to discuss alternative names 馃憤

value is the closest name to existing APIs so it's the best option like @felangel pointed out.

@felangel I see where you are coming from, and it makes a lot of sense. Is possible that value is not the most expressive name but at least is consistent. Thank you so much for taking the time to explain your rationale.

NOTE: I'll close this since I'm pretty much satisfied with the response I got. Please feel free to re-open if you feel like there is something more to discuss 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

frankrod picture frankrod  路  3Comments

shawnchan2014 picture shawnchan2014  路  3Comments

nhwilly picture nhwilly  路  3Comments

krusek picture krusek  路  3Comments

rsnider19 picture rsnider19  路  3Comments