amar_1995
01/27/2020, 11:21 AMIO thread. But as, I use this in below code, It will throw eroor Not in a frame
fun<T> observer(data: LiveData<T>) = effectOf<T?> {
var result = +state<T?> { data.value }
val observer = +memo { Observer<T> { result.value = it }}
+onCommit(data) {
data.observeForever(observer)
onDispose { data.removeObserver(observer) }
}
// commit()
result.value
}amar_1995
01/27/2020, 11:24 AMopen and commit but cannot able to figure out how exactly to use it.
When I tried to use open i got this error java.lang.IllegalStateException: no stage finishing is allowed while read is disabledZsolt
01/27/2020, 11:56 AMamar_1995
01/27/2020, 12:00 PMviewModelScope with main threadamar_1995
01/27/2020, 12:04 PMprivate lateinit var nationHeadline: LiveData<ViewState>
init {
viewModelScope.launch(Dispatchers.Main) {
nationHeadline = articleRepo.loadHeadlineNation().asLiveData()
}
}Zsolt
01/27/2020, 12:05 PMZsolt
01/27/2020, 12:05 PMamar_1995
01/27/2020, 12:07 PMopen
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1572188729016400Zsolt
01/27/2020, 12:08 PMamar_1995
01/27/2020, 12:10 PMamar_1995
01/27/2020, 12:12 PMZsolt
01/27/2020, 12:16 PMZsolt
01/27/2020, 12:16 PMamar_1995
01/27/2020, 12:16 PMBrady Aiello
01/28/2020, 6:26 AMIan Warwick
01/28/2020, 1:51 PMDispatchers.Main for now they do work, just not on any other dispatcher AFAIKLeland Richardson [G]
02/03/2020, 6:13 PMZsolt
02/03/2020, 6:26 PMLeland Richardson [G]
02/03/2020, 6:28 PMIan Warwick
02/03/2020, 6:33 PM