Bloc: Motion to export the bloc family bloc extensions from package:bloc

Created on 3 Sep 2020  路  5Comments  路  Source: felangel/bloc

Libraries like HydratedBloc, cubit (now merged) replay_bloc, and others are nice additions to the bloc library that are going to suffer from visibility issues.

I propose we integrate them all into one library to make importing and discovery easier. I don't see any downsides to this approach.

discussion enhancement feedback wanted

Most helpful comment

What if, instead of merging them, they were just exported but still individually managed? Just like how bloc is exported from flutter_bloc. Just so that people who depend on flutter_bloc have all the other packages as options built in without having to discover or import them. Is this a bad idea? The libraries _are_ closely related. I don't see how simply adding an export would make hydrated_bloc have a Flutter dependency

All 5 comments

Hi @ThinkDigitalSoftware 馃憢
Thanks for opening an issue!

I've thought about this and I would really prefer from a maintenance standpoint to keep the packages decoupled and for cases like hydrated_bloc we would need make bloc have a dependency on flutter (in its current state) which I don't want to do.

I'm open to additional thoughts/feedback and am all for making the other packages more visible 馃憤

What if, instead of merging them, they were just exported but still individually managed? Just like how bloc is exported from flutter_bloc. Just so that people who depend on flutter_bloc have all the other packages as options built in without having to discover or import them. Is this a bad idea? The libraries _are_ closely related. I don't see how simply adding an export would make hydrated_bloc have a Flutter dependency

@ThinkDigitalSoftware by adding an export we are introducing a dependency. If flutter_bloc exports replay_bloc and hydrated_bloc then flutter_bloc has a dependency on replay_bloc and hydrated_bloc. I can see the argument for always exporting bloc from each package because bloc is the core library which is needed in all cases but I feel that exporting optional extensions like replay_bloc and hydrated_bloc isn't a good idea because they will all be interdependent making maintenance and versioning more difficult.

Also, if we exported hydrated_bloc and/or flutter_bloc from bloc then the bloc package would no longer be pure dart because it would have a transitive dependency on flutter.

I would really prefer to keep the dependency graph clean between the packages and allow developers to pick and choose which dependencies they want. Thoughts on just making the change to export bloc as part of each library (like flutter_bloc is currently doing)?

Ok, that makes sense. Yeah that's fine

All packages should export package:bloc/bloc.dart now 馃帀

Was this page helpful?
0 / 5 - 0 ratings