Exercise 6.01 – Handling Flow exception in an Android app
In this exercise, you will be continuing with the movie app you worked on in Exercise 5.01 – Using Kotlin Flow in an Android app. This application displays the movies that are playing now in movie theaters. You will be updating the project to handle Flow cancelations and exceptions by following these steps:
- In Android Studio, open the movie app you worked on in Exercise 5.01 – Using Kotlin Flow in an Android app.
- Go to the
MovieViewModel
class. In thefetchMovies
function, remove the line that sets the value of_loading
totrue
. Your function will look like the following:fun fetchMovies() { viewModelScope.launch (dispatcher) { MovieRepository.fetchMoviesFlow() .collect { ...