I’m looking for a way to send Any function as a parameter and get back a suspended function
this is one example of the possible function and how I am solving this:
Possible function
fun getSomething(): List<SomethingObject>
Incorrect approachment
suspend fun AnyClass.awaitAll(): List<SomethingObject> = withContext(Dispatchers.IO) { getSomething() }
But what I really want is something like this:
suspend fun <T : Any?> safeQuery(query: () -> Unit): () -> Unit {
return withContext(Dispatchers.IO) { query }
}