How to replace LiveData with Flow
问题 I've one LiveData named sortOrder and then I've another variable named myData that observes any change to sortOrder and populates data accordingly. class TestViewModel @ViewModelInject constructor() : ViewModel() { private val sortOrder = MutableLiveData<String>() val myData = sortOrder.map { Timber.d("Sort order changed to $it") "Sort order is $it" } init { sortOrder.value = "year" } } Observing in Activity class TestActivity : AppCompatActivity() { private val viewModel: TestViewModel by