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

commonMain.pro.respawn.flowmvi.compose.preview.EmptyReceiver.kt Maven / Gradle / Ivy

package pro.respawn.flowmvi.compose.preview

import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import pro.respawn.flowmvi.api.IntentReceiver
import pro.respawn.flowmvi.api.MVIIntent

@Immutable
private object EmptyReceiver : IntentReceiver {

    override fun intent(intent: MVIIntent): Unit = Unit
    override suspend fun emit(intent: MVIIntent): Unit = Unit
}

/**
 * An [IntentReceiver] that does nothing and ignores all intents. Most often used for Composable previews.
 */
@Composable
public fun  EmptyReceiver(
    @BuilderInference call: @Composable IntentReceiver.() -> Unit,
): Unit = call(EmptyReceiver as IntentReceiver)