nonAndroidMain.dev.stateholder.extensions.CollectAsState.nonAndroid.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of extensions-compose Show documentation
Show all versions of extensions-compose Show documentation
A simple library for managing state in Kotlin Multiplatform projects, using Kotlin Coroutines and `StateFlow`.
package dev.stateholder.extensions
import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.runtime.collectAsState
import com.arkivanov.essenty.lifecycle.Lifecycle
import dev.stateholder.StateOwner
import kotlin.coroutines.CoroutineContext
@Composable
public actual fun StateOwner.collectAsState(
minActiveState: Lifecycle.State,
context: CoroutineContext,
): State {
return state.collectAsState(context = context)
}