I am a mobile developer and always ready to make your Ideas into Reality
📱Mobile App Developer | Android & Flutter 🌟💡 Passionate about creating intuitive and engaging apps 💭✨ Let’s shape the future of mobile technology!
Markdown supported · ⌘↵ to post
Roger Colque Calcina
hello i saw other way @Module @InstallIn(SingletonComponent::class) object RepositoriesModule {
@Provides @Singleton fun provideNewsRepository( apiService: NewsApiService ): NewsRepository = NewsRepositoryImpl ( apiService) } -
class NewsRepositoryImpl ( private val apiService: NewsApiService
) : NewsRepository {....
VS
@Module @InstallIn(SingletonComponent::class) abstract class RepositoryModule {
@Binds abstract fun bindNewsRepository( impl: NewsRepositoryImpl ): NewsRepository } -
class NewsRepositoryImpl @Inject constructor( private val apiService: NewsApiService
) : NewsRepository {....
Basically use bind for repos and singleton only for retrofit room
why not this way?