e

    enighma

    11 months ago
    Update 2:
    @JvmSuppressWildcards
    Adding that to the constructor injection site did the trick. @ephemient thank you! 🙂 Update 1: In my use-case below
    MyType
    was a sealed class, which is what caused the issue. Original message: I think this question applies here even though I'm using hilt: I have a provider function that provides a kotlinflow like so:
    fun provideX(): Flow<MyType>
    However, when I try to compile I get "cannot be provided without an @Provides-annotated method". I'm guessing it wants a provider for MyType? I'm not sure, because it seems to work if it's:
    fun provideX(): Flow<Long>
    I guess in general, are there any recommendation around flows/async together with dagger/hilt?
    e

    ephemient

    11 months ago
    @JvmSuppressWildcards
    e

    enighma

    11 months ago
    Thanks, but that didn't work. This is what I have with your suggestion
    @JvmSuppressWildcards
    @Provides
    fun providesTokenImpl(tokenManager: TokenManager): StateFlow<Token> {
    and Token is a sealed class:
    sealed class Token
    object NoToken : Token()
    data class RealToken(
    If I change the provides to
    StateFlow<RealToken>
    it works 😕
    Got it working by adding that to the injection site. Thanks you!