如何将 HiltViewModelFactory 注入到非 Android 组件中,如 Conductor 的 Controller.. 等。目前我有这段代码,但它不起作用,说不能提供 HiltViewModelFactory。
@EntryPoint
@InstallIn(ActivityComponent::class)
interface MyClassInterface {
fun viewModelFactory(): HiltViewModelFactory
}
private val viewModelStore = ViewModelStore()
private val viewModelFactory by lazy {
EntryPoints.get(requireContext(), MyClassInterface::class.java).viewModelFactory()
}