Closed Janekxyz closed 4 years ago
Hi, I checked this case and there were no problems.
class TestClass(val callback: () -> Unit) {}
factory { (callback: () -> Unit) -> TestClass(callback) }
private val testClass by scope.inject<TestClass> {
parametersOf({
Timber.e("TEST")
})
}
testClass.callback()
2020-05-23 12:25:11.977 3347-3347/com.arttttt.koinsample E/FragmentB$testClass: TEST
Is is possible to inject function as a parameter? I'm trying to inject function to class but it's return CastException:
Caused by: java.lang.ClassCastException: MyCustomFragment$adapter$2$1 cannot be cast to kotlin.jvm.functions.Function1
koin_version = '2.1.5'