Thread
#compose
    k

    Kshitij Patil

    1 year ago
    Has anyone used Hilt with Compose? I'm willing to inject different instances of same type based on some condition. Also, is it possible to inject dependencies directly into a composable? I think 'Ambient' is another way of maintaining dependencies.
    Jeremy

    Jeremy

    1 year ago
    I'm using it at the activity/application level. compose functions you can just pass in dependencies or functions like
    @Composable
    fun MyCoolWidget(doSomething: (String) -> Unit) {}
    call it via
    MyCoolWidget(myViewModel::doSomething)