All Downloads are FREE. Search and download functionalities are using the official Maven repository.

blockingMain.org.jetbrains.compose.resources.ResourceState.blocking.kt Maven / Gradle / Ivy

package org.jetbrains.compose.resources

import androidx.compose.runtime.*
import kotlinx.coroutines.runBlocking

@Composable
internal actual fun  rememberResourceState(
    key1: Any,
    getDefault: () -> T,
    block: suspend (ResourceEnvironment) -> T
): State {
    val environment = LocalComposeEnvironment.current.rememberEnvironment()
    return remember(key1, environment) {
        mutableStateOf(
            runBlocking { block(environment) }
        )
    }
}

@Composable
internal actual fun  rememberResourceState(
    key1: Any,
    key2: Any,
    getDefault: () -> T,
    block: suspend (ResourceEnvironment) -> T
): State {
    val environment = LocalComposeEnvironment.current.rememberEnvironment()
    return remember(key1, key2, environment) {
        mutableStateOf(
            runBlocking { block(environment) }
        )
    }
}

@Composable
internal actual fun  rememberResourceState(
    key1: Any,
    key2: Any,
    key3: Any,
    getDefault: () -> T,
    block: suspend (ResourceEnvironment) -> T
): State {
    val environment = LocalComposeEnvironment.current.rememberEnvironment()
    return remember(key1, key2, key3, environment) {
        mutableStateOf(
            runBlocking { block(environment) }
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy