Skip to content
Discussion options

You must be logged in to vote

If you want it to participate in your DI graph you need to put that binding on your DI graph rather than have it be an assisted parameter. A common way people handle this scenario is they make a graph extension specific to that scope (for example a ProfileGraph) that takes that ID in as a @Provides input in its factory.

@DependencyGraph
interface AppGraph {
  // ...

  val profileGraphFactory: ProfileGraph.Factory
}

@GraphExtension
interface ProfileGraph {
  @GraphExtension.Factory
  interface Factory {
    fun create(@Provides userId: String): ProfileGraph
  }
}

Then everything in the scope of the ProfileGraph would have access to that userId binding in injection.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sabrak
Comment options

Answer selected by ZacSweers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants