Now that we have added some data into our shopping.db database, it's time to show that data to the user. We'll begin by showing the available shopping lists on the first screen, in a ListView. After the user taps on any item of the list, they'll get to the second screen of the app, which will show all the items in the shopping list.
First, we'll create a function that retrieves the content of the lists table in our database, using a sqflite helper method, as follows:
- In the DbHelper class, add a new method called getLists() that will return a Future of a List, containing a ShoppingList. As usual, this will be asynchronous. The following code snippet illustrates this:
Future<List<ShoppingList>> getLists() ...