For using koin on compose, I used koinInject.
However when composable function need to be injected nullable type, koinInject throw NoBeanDefFoundException.
It's because koinInject uses scope.get instead scope.getOrNull on below code.
@Composable
inline fun <reified T : Any> rememberKoinInject(
qualifier: Qualifier? = null,
scope: Scope = getKoinScope(),
noinline parameters: ParametersDefinition? = null,
): T? {
val st = rememberStableParametersDefinition(parameters)
return remember(qualifier, scope) {
scope.get(qualifier, st.parametersDefinition)
}
}
This is necessary when providing optional module based on different flavor.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
For using koin on compose, I used
koinInject
. However when composable function need to be injected nullable type,koinInject
throwNoBeanDefFoundException
.It's because
koinInject
usesscope.get
insteadscope.getOrNull
on below code.This is necessary when providing optional module based on different flavor.