Colton Idle
07/28/2023, 2:53 PMprivate val foo by inject<Foo>(Foo::class._java_)
but sometimes I can have
private val foo by _inject_<Foo>()
anyone know? (sorry koin noob)arnaud.giuliani
07/28/2023, 2:57 PMcurioustechizen
07/28/2023, 3:25 PMColton Idle
07/28/2023, 4:08 PMinject
ill keep debuggingJavier
07/28/2023, 5:37 PMthis
) is correct?
if not you aren’t in an activity or fragment, and you must extend from KoinContext (or even better using constructor injection)Colton Idle
07/28/2023, 6:51 PMColton Idle
07/28/2023, 6:52 PMJavier
07/28/2023, 7:23 PMColton Idle
07/28/2023, 11:39 PMJavier
07/28/2023, 11:43 PMinject
is when you are not able to instantiate the classes, if not, they should be injected via parameters
not sure if Koin is addressing this issue in Android, but, nowadays, there is no reason to not inject everything via constructors, even in Activities and Fragments except due some legacy limitationJavier
07/28/2023, 11:44 PMJavier
07/28/2023, 11:44 PMJavier
07/28/2023, 11:45 PMAppComponentFactory
which you can put on the manifest
<application android:appComponentFactory=".HiltOrKoinCodegenComponentFactory" />
Which should allow to inject everything via constructorJavier
07/28/2023, 11:46 PMStarting from API Level 28
Colton Idle
07/29/2023, 12:55 AMColton Idle
07/29/2023, 12:55 AM