2024/08/29 3

[Android] LiveData - Flow로 마이그레이션

#1 이전 글 [Kotlin] Coroutines Flow - StateFlow#1 개요 StateFlowA SharedFlow that represents a read-only state with a single updatable data value that emits updates to the value to its collectors. A state flow is a hot flow because its active instance exists independently of the presence of collectokenel.tistory.comStateFlow에 대해 다룬 이전 글에서 이어진다. LiveData가 쓰인 XML 기반 View 프로젝트를 수정해, LiveData를 StateFlow로..

[Android] Jetpack Compose - StateFlow와 SharedFlow

#1 이전 글 [Kotlin] Coroutines Flow - StateFlow#1 개요 StateFlowA SharedFlow that represents a read-only state with a single updatable data value that emits updates to the value to its collectors. A state flow is a hot flow because its active instance exists independently of the presence of collectokenel.tistory.comStateFlow에 대해 다룬 이전 글에서 이어진다. State가 쓰인 Jetpack Compose 프로젝트를 수정해, State 대신 StateFlow를..

[Kotlin] Coroutines Flow - Flow.combine()과 Flow.stateIn()

#1 개요 combineReturns a Flow whose values are generated with transform function by combining the most recently emitted values by each flow. It can be demonstrated with the following example: val flow = flowOf(1, 2).onEach { delay(10) }val flow2 = flowOf("a", "b", "c").okotlinlang.org stateInConverts a cold Flow into a hot StateFlow that is started in the given coroutine scope, sharing the most re..