google android official doc 기본설명

https://developer.android.com/topic/libraries/architecture/livedata

LiveData with coroutines – official doc

https://developer.android.com/topic/libraries/architecture/coroutines#livedata

When using LiveData, you might need to calculate values asynchronously. For example, you might want to retrieve a user’s preferences and serve them to your UI. In these cases, you can use the liveData builder function to call a suspend function, serving the result as a LiveData object.

val user: LiveData<User> = liveData {
   val data = database.loadUser() // loadUser is a suspend function.
   emit(data)
}

emit() 과 emitSource()의 차이점

https://stackoverflow.com/a/58950866/3151712

Comments are closed.

Post Navigation