Interfaceを使用してRepositoryをDIする時のメモ

ライブラリが提供しているモジュールをインジェクトする時と同様に、 provideメソッドを書いてあげれば大丈夫。

@Module
@InstallIn(SingletonComponent::class)
class RepositoryModule {

    @Provides
    @Singleton
    fun provideHogeRepository(
        httpClient: HttpClient,
        @IODispatcher
        dispatcher: CoroutineDispatcher
    ): HogeRepository {
        return HogeRepositoryImpl(
            httpClient,
            dispatcher
        )
    }
}

interface HogeRepository //

class HogeRepositoryImpl //