I have an `:app` module and then a `network` modul...
# dagger
I have an
module and then a
module. I want the network module to expose services like BooksService and LibraryService. Those two services require a OkHttpClient. I can also add a provider for the http client, but then okhttpClient provider is exposed to the app. Anyway to hide that "internal" dependency with dagger?
Copy code
networkModule's provider declaration:

fun provideBooksService(okHttpClient: OkHttpClient): BooksService {
  return NetworkBackedBooksService(okHttpClient)

fun provideLibraryService(okHttpClient: OkHttpClient): LibraryService {
  return NetworkBackedLibraryService(okHttpClient)

fun providesHttpClient(): OkHttpClient {
  return //...
Would something like what’s described here work for you? https://www.zacsweers.dev/dagger-party-tricks-private-dependencies/
i just opened the link and the first example pretty much looks like what id want. CHEERS!
wow. this is exactly what i wanted. so glad i asked the question. thank you
If I remember correctly you can just use internal fun + @PublishedApi
oh. I'll try that as well just out of curiosity and report back. 😄
FWIW. I tried the PublishedApi suggestion and it didn't seem to work. Going to steal Zacs suggestion instead from the article 😄