Skip to content

Instantly share code, notes, and snippets.

@qwert2603
Created January 20, 2021 17:21
Show Gist options
  • Save qwert2603/c405d7b2edf01c80048b519599b64e8e to your computer and use it in GitHub Desktop.
Save qwert2603/c405d7b2edf01c80048b519599b64e8e to your computer and use it in GitHub Desktop.
protected class ViewModelStateFlowImpl<T>(initial: T) : ViewModelStateFlow<T> {
val wrapped = MutableStateFlow(initial)
override val value: T
get() = wrapped.value
override val replayCache: List<T>
get() = wrapped.replayCache
@InternalCoroutinesApi
override suspend fun collect(collector: FlowCollector<T>) {
wrapped.collect(collector)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment