I'm developing an app with clean architecture principles. I've a domain module which is a Java/Kotlin module and it hasn't android dependencies and a domainImpl module which is an Android module and has dependencies to local, remote and domain module. this is a Repository example inside domain module:
interface MovieRepository {
fun getMovie(id: Long): Flow<Movie>
}
and below code is it's implementation inside domainImpl module:
class MovieRepositoryImpl(
private val movieApi: MovieApi
) : MovieRepository {
override fun getMovie(id: Long): Flow<Movie> = flow {
emit(movieApi.getMovie(id))
}
}
Everything works fine in this case. But Now I'm trying to add Android Paging 3 for my pagination. So I have to add a method to the MovieRepository interface like:
fun getMovies(): Flow<PagingData<Movie>>
But before this I've to add Paging library to my domain module but unfortunately it is an Android library and I couldn't find a core dependency for it. So What can I do about it? Do I have to change my domain module to an android module because of this? Or is there any other workaround?