i'm paginating list and loading 5 items each time ...
# coroutines
k
i'm paginating list and loading 5 items each time recyclerview scrolled to last , then using
coroutine
i'm getting more data for each item from network like below
Copy code
private fun onItemsLoaded(videosList: List<BaseVideo>) {
        uiScope.launch {
            val videoAndData = getUserDataForEachVideo(videosList)//suspending function
            adapter.addData(videoAndData)
        }
    }
so here everytime whenever new 5 items loaded then
new
coroutine
is created, so here over the time it will increase created coroutines , i know that coroutines are light weight but is there any other way to solve this problem where i can create a single coroutine and then run my code inside that coroutine instead of creating new coroutine everytime
s
i