Carlo Codega
Carlo Codega

Reputation: 103

Get Initializer result from Hilt module

Simple question here: is it possible to get an object initilized through app startup Initializer inside a Hilt module?

Let me provide an example. Assume that I've the following Initializer:

class AnalyticsInitializer: Initializer<Analytics> {
    override fun create(context: Context): Analytics {
        return A
    }
}

and a Hilt module:

@Provides
@Singleton
fun provideAnalytics(): Monitor =
    // get the object A returned by AnalyticsInitializer

Any hint? Are there any alternatives?

Upvotes: 0

Views: 16

Answers (0)

Related Questions