Kodein 4.1 What am I doing wrong/forgetting here? ...
# kodein
l
Kodein 4.1 What am I doing wrong/forgetting here? I have a concrete class
class Foo(view:ViewFoo)
And a Kodein.Lazy with this binding
Copy code
bind<Foo>() with scopedSingleton(androidFragmentScope) {
            Foo(it)
        }
and on my `MyFragment(), ViewFoo`I’m retrieving like this
val foo by kodein.with(this).instance<Foo>()
But then it throws this error
Copy code
No factory found for bind<Foo>() with ? { MyFragment -> ? }
  
Registered in Kodein:
   bind<Foo>() with scopedSingleton(androidFragmentScope) { Fragment -> Foo }
a
have you tried
with(this as Fragment)
?
l
hmm
gonna try
it failed too, slightly different error message
Copy code
No factory found for bind<Foo>() with ? { Fragment -> ? }
maybe because differences between support Fragment and Fragment
?
My app uses support Fragment but androidFragmentScope uses
android.app.Fragment
a
yeah, thats definitly a problem
use
androidSupportFragmentScope
l
Ha! I don’t know why I didn’t look for this before, thanks!