Hi all. I'm trying a very simple example with an `...
# dagger
m
Hi all. I'm trying a very simple example with an
@AssistedInject
class.
Copy code
class CalculatorImpl @AssistedInject constructor(
    private val logger: Logger,
    @Assisted private val increment: Int
) : Calculator {

  override fun addOne(a: Int) = a.inc().apply {
    logger.log("New value is $this")
  }
}
The
@AssistedFactory
is the following
Copy code
@AssistedFactory
interface CalculatorImplFactory {

  fun create(
      inc: Int
  ): CalculatorImpl
}
When I try to inject the
CalculatorImplFactory
in an Activity like this
Copy code
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

  @Inject
  lateinit var calculatorFactory: CalculatorImplFactory
  // ...
}
When I build I get a
Copy code
CalculatorImplFactory cannot be provided without an @Provides-annotated method.
The documentations says that
Dagger will create the implementation for the assisted factory and provide a binding for it.
but this doesn't seem to be true. What am I missing? Thanks
My mistake. I was using version
2.28.3-alpha
for Hilt. With
2.31.2-alpha
everything is good 🙂
🎉 2