Adding a ListView to show data

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:

  1. 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;
  1. Then, create a new method, called initialize. It returns a future and is marked as async.
  2. Inside the method, call the getUpcoming method from ...

Get Flutter Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.