Instead of showing a single piece of text, with no user interaction whatsoever, for the UI, we'll use one of the most common widgets that deals with data: the ListView. This will allow our user to scroll vertically through the movies. And as the ListView can contain any type of widget, it will give us the freedom to show data in any way we want:
- So, let's open the movie_list.dart file, and at the top of the _MovieListState class, let's create two variables, which will contain the list of movies and the number of movies that were retrieved:
int moviesCount;
List movies;
- Then, create a new method, called initialize. It returns a future and is marked as async.
- Inside the method, call the getUpcoming method from the httpHelper class, and then call the setState method so that we can set moviesCount and the movie's properties:
Future...