Given I have a function `fun foo(block: (bar: Bar)...
# coroutines
m
Given I have a function
fun foo(block: (bar: Bar) -> Unit)
Is there a way to have
suspend fun coFoo(block: suspend (bar:Bar) -> Unit)
that could internally use somehow the non suspending
foo
function to avoid code duplication?
s
One option is to make
foo
an inline function
Then you just need one implementation, but
block
will be allowed to suspend when
foo
is called from a suspend function
👍 1
m
Thanks, I guess this is what I was looking for 🙏