Modular core: Bind-only modules? #750
marcguilera
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for this package as I think it is a great option to help write cleaner code. Modular uses the concept of
Module
which ties together bindings and routes for shelf and flutter. This makes sense as it is aware of where we are in the application and uses that to manage the lifecycle of the different objects but has a problem in my view.From an only DI standpoint it seems it would be nice to create modules which only contain bindings from
modular_core
so we can have bindings declared in packages that don't and shouldn't depend on flutter or shelf. This bind-only modules would then be imported into application modules and eventually used in the app or in shelf.If we look at the competition this is a common approach. For example
riverpod
can be used from pure dart and thenriverpod_flutter
is the package which adds the lifecycle awareness through widgets. Similarlyget_it
can be used from pure dart and one can useget_it_mixin
to get the Flutter goodness.So my question is if there would be room for adding an implementation
Module
(or whatever) name tomodular_core
and the binds.Unrelated set of questions:
Scope
.onLoaded
,onUnloaded
. This I think can be somewhat bypassed adding a singleton binding with logic for creation in the constructor and destruction in the dispose method.Beta Was this translation helpful? Give feedback.
All reactions