title: how to correctly implement kotlin coroutines with Paging Library?
body: <p>I have an android app in which i want to implement Kotlin Couroutines, the confusion I am having is where do I use the coroutine. I have the viewModel as- </p>
  
  <pre><code>class PostViewModel : ViewModel() {
  
      var postPagedList: LiveData&lt;PagedList&lt;UnsplashImageDetails&gt;&gt;? = null
      private var postLiveDataSource: LiveData&lt;PageKeyedDataSource&lt;Int, UnsplashImageDetails&gt;&gt;? = null
  
      var popularPagedList: LiveData&lt;PagedList&lt;UnsplashImageDetails&gt;&gt;? = null
      private var popularLiveDataSource: LiveData&lt;PageKeyedDataSource&lt;Int, UnsplashImageDetails&gt;&gt;? = null
  
      init {
          val postDataSourceFactory = PostDataSourceFactory()
          val popularDataSourceFactory = PopularDataSourceFactory()
  
          postLiveDataSource = postDataSourceFactory.getPostLiveDataSource()
          popularLiveDataSource = popularDataSourceFactory.getPopularLiveDataSource()
  
          val config: PagedList.Config = (PagedList.Config.Builder()).setEnablePlaceholders(false)
              .setPageSize(PostDataSource().PAGE_SIZE).build()
          val configPop: PagedList.Config = (PagedList.Config.Builder()).setEnablePlaceholders(false)
              .setPageSize(PopularDataSource().PAGE_SIZE).build()
  
          postPagedList = LivePagedListBuilder(postDataSourceFactory, config).build()
          popularPagedList = LivePagedListBuilder(popularDataSourceFactory, configPop).build()
      }
  }
  </code></pre>
  
  <p>where should I use the async method, within this activity or in the repository class where I fetch data through retrofit.</p>