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

commonMain.com.eygraber.vice.sources.FlowSource.kt Maven / Gradle / Ivy

The newest version!
package com.eygraber.vice.sources

import androidx.compose.runtime.Composable
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.eygraber.vice.ViceSource
import kotlinx.coroutines.flow.Flow

public abstract class FlowSource : ViceSource {
  protected abstract val flow: Flow

  protected abstract val initial: T

  @Composable
  final override fun currentState(): T = flow.collectAsStateWithLifecycle(initial).value
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy