google android official doc 기본설명

LiveData with coroutines – official doc

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() 과 emitSource()의 차이점

Comments are closed.

Post Navigation