for purposes of Room db. I want to run some coroutines inside Recycler View.
Necessary suspend functions are handled as a class parameters:
class RecyclerAdapter (private val exist : suspend (lastName : String) -> Boolean)
And then, when needed I'm using following construction:
GlobalScope.launch(Dispatchers.IO) {
if (exist(dataSet[position].lastName))
[...]
I'm not sure if using the Global Scope is the best practice. I considered using lifecycleScope but in Adapter lifecycleOwner is not available, handling it as a parameter is not a good practice.
What would you guys suggest?