AM
fun observeLocation(): Flow<UserLocation> = callbackFlow { callback = { offer(it) } }
что я делаю не так?
Получаю эксепшн ClosedSendChannelException: Channel was closed
Size: a a a
AM
AM
MM
BP
sealed class Ctx
class SimpleCtx : Ctx()
class ComplexCtx : Ctx()
typealias SimpleCtxF<T> = (SimpleCtx) -> T
typealias ComplexCtxF<T> = (ComplexCtx) -> T
fun <T> evalSimple(simpleCtxF: SimpleCtxF<T>): T = evalImpl(SimpleCtx(), simpleCtxF)
fun <T> evalComplex(complexCtxF: ComplexCtxF<T>): T = evalImpl(ComplexCtx(), complexCtxF)
private fun <CTX : Ctx, T> evalImpl(ctx: CTX, f: (CTX) -> T): T {
/** some common actions */
val isComplex = when (ctx as Ctx) {
is SimpleCtx -> false
is ComplexCtx -> true
}
return try {
if (isComplex) {
/** pre eval actions for complex context */
}
val t = f(ctx)
if (isComplex) {
/** on success actions for complex context */
}
t
} catch (t: Throwable) {
if (isComplex) {
/** on failure actions for complex context */
}
throw t
} finally {
if (isComplex) {
/** cleanup actions for complex context */
}
}
}
LS
n
LS
AZ
VP
t
VM
M
lateinit var
Kd
VM
QH
VM
QH
VM
presenter.setActiveGuids()
наpresenter?.setActiveGuids() ?: ""
?