Is it possible to have multibinding with Koin as i...
# koin
y
Is it possible to have multibinding with Koin as intoMap or intoSet functionalities like in Dagger2?
a
y
That still requires explicit access to the instance, which defeats all the benefit. By adding to set or map, I could use another layer of abstraction and benefit of not knowing, and actually not caring which items in it. That gives me possibility to use a different set of items on different conditions.
a
do you have a snippet for your usecase?
y
Assuming I want to build similar concept with Koin https://link.medium.com/Qmdgo0u6DX Provide different applicationPlugin into a set depending on which build type that I build, but without needing to change anything in code where it is used.
a
if you use secondary typing with
bind
, you can request all your components with koin.getAll<ApplicationPlugin>() to get all your instances
👍 1
with each definition like:
single { CalligraphyPlugin() } bind ApplicationPlugin::class
y
Oh, nice! Thanks ✌️
Assuming that returns list - is there a way to create map as well?
273 Views