Package-level declarations

Types

Link copied to clipboard
class ComponentTreeScope(lithoTree: LithoTree, val coroutineContext: CoroutineContext) : CoroutineScope

A CoroutineScope that is scoped to whether the ComponentTree is released.

Link copied to clipboard
interface StateProducerScope<T> : CoroutineScope

Properties

Link copied to clipboard
val LithoTree.lithoTreeScope: CoroutineScope

Lazily creates a CoroutineScope that will be active as long as the ComponentTree is not released. This scope will be canceled when the ComponentTree is released.

Functions

Link copied to clipboard
fun ComponentScope.useCoroutine(onLaunch: suspend CoroutineScope.() -> Unit)

Launches a coroutine with onLaunch. The coroutine will be canceled when the component is detached, or if the coroutine will be relaunched.

fun ComponentScope.useCoroutine(vararg keys: Any?, onLaunch: suspend CoroutineScope.() -> Unit)

Launches a coroutine with onLaunch whenever keys change. The coroutine will be canceled when the component is detached, or if the coroutine will be relaunched.

Link copied to clipboard
fun <T> ComponentScope.useFlow(stateFlow: StateFlow<T>): T

Uses the current value of a given stateFlow in a Litho Kotlin component.

fun <T> ComponentScope.useFlow(initialValue: () -> T, flowBlock: suspend () -> StateFlow<T>)

Uses the collection of a StateFlow that is dynamically supplied by flowBlock.

fun <T> ComponentScope.useFlow(initialValue: () -> T, vararg keys: Any?, flowBlock: suspend () -> StateFlow<T>): T

Uses the collection of a StateFlow that is dynamically supplied by flowBlock, which will be executed whenever the given keys change.

Link copied to clipboard
fun <T> ComponentScope.useProducer(initialValue: () -> T, vararg keys: Any?, producer: suspend StateProducerScope<T>.() -> Unit): T

Creates a value that is updatable by a given producer coroutine. Whenever producer updates the value, the component will be re-rendered.