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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks for this package as I think it is a great option to help write cleaner code. Modular uses the concept of
Modulewhich 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_coreso 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
riverpodcan be used from pure dart and thenriverpod_flutteris the package which adds the lifecycle awareness through widgets. Similarlyget_itcan be used from pure dart and one can useget_it_mixinto get the Flutter goodness.So my question is if there would be room for adding an implementation
Module(or whatever) name tomodular_coreand 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