Updated on 2026-08-14
This commit is contained in:
parent
680794d447
commit
a61004a3c1
18 changed files with 459 additions and 106 deletions
|
|
@ -0,0 +1,18 @@
|
|||
package com.tangem.core.decompose.utils
|
||||
|
||||
import com.arkivanov.decompose.router.stack.StackNavigation
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import kotlin.coroutines.resume
|
||||
|
||||
/**
|
||||
* Retrieves the current stack of items from the [com.arkivanov.decompose.router.stack.ChildStack]
|
||||
* @return A list representing the current stack of items
|
||||
*/
|
||||
suspend fun <T : Any> StackNavigation<T>.stack(): List<T> {
|
||||
return suspendCancellableCoroutine { continuation ->
|
||||
this.navigate(
|
||||
transformer = { stack -> stack },
|
||||
onComplete = { newStack, oldStack -> continuation.resume(newStack) },
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue