Pablo
07/05/2022, 9:17 AMinterface Foo<T> {
fun onSuccess(lis: (T?) -> Unit)
}
I'm trying to do something like this :
suspend fun getFoo(): Bar {
suspendCoroutine<Bar?> { continuation ->
val listener = object : Foo<Bar?> {
override fun onSuccess(lis: (Bar?) -> Unit) { }
}
}
But I don't know how to return a BarJoffrey
07/05/2022, 9:22 AMonSuccess
is probably not a callback, but a function to register a callback. I don't think it's expected that you create an instance of Foo
yourself here. Could you please share the real-life names for those types? Coroutines aside, how is Foo
supposed to be used with the callback approach?