https://kotlinlang.org logo
Title
d

dave08

02/01/2023, 1:49 PM
If there's no classes registered in say a
Set<FooInterface>
that's being injected, is there a way to make it default to passing an emptySet? (It's for a plugin system... just preparing the framework for it right now...) I know I could always use a provider in the component for that, but then when I add actual implementations, won't that break?
e

evant

02/01/2023, 6:59 PM
You are correct that would break. One thought is you could have a stub impl of the interface to make sure an item is already provided but that's a bit ugly. Feel free to open an issue about this. Looks like dagger solves it with an annotation to provide a set of items which can be an empty set https://dagger.dev/dev-guide/multibindings.html#alternative-elementsintoset-returning-an-empty-set