Hovhannes
08/13/2021, 1:35 PM@Singleton
@Provides
fun provideAuthApi(
remoteDataSource: RemoteDataSource,
string: String
): AuthApi {
return remoteDataSource.buildApi(AuthApi::class.java, string)
}
@Singleton
@Provides
fun provideUserApi(
remoteDataSource: RemoteDataSource,
string: String
): UserApi {
return remoteDataSource.buildApi(UserApi::class.java, string)
}
knthmn
08/13/2021, 2:34 PMAuthApi
and UserApi
, it needs to get a String
which you have not provided.
@Provides
fun provideStringForApi(/* dependency for the string */): String = /* return the string */
string
actually is due to your naming, however it is not recommended to have something as generic as String
in your dependency graph without specifying it with a Qualifier
.
https://developer.android.com/training/dependency-injection/hilt-android#multiple-bindings