The Text A and Code A are from this article .
I'm very strange why they don't use Code B or Code C to instantiate the user object. I think Code B and Code C are very simple and clear.
BTW, I havn't test Code B and Code C, but I think that they are correct.
Text A
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. In the example below, loadUser() is a suspend function declared elsewhere. Use the liveData builder function to call loadUser() asynchronously, and then use emit() to emit the result
Code A
val user: LiveData<User> = liveData {
val data = database.loadUser() // loadUser is a suspend function.
emit(data)
}
Code B
val user: LiveData<User> = MutableLiveData<User>(database.loadUser())
Code C
val user = MutableLiveData<User>(database.loadUser())