One of the touch gestures that has won a wide adoption over time in mobile apps is the "swipe-to-delete" gesture, in which you simply drag a finger across an item, and swipe it left—or in some cases, also right.
This was introduced by Apple in the Mail app, and today it's widely spread in both iOS and Android systems.
What we want to achieve here is to delete an item in the ListView by swiping left or right. The first step is creating a method in our DbHelper class that will actually delete a record from the database, as follows:
- We'll call this method deleteList(). As usual, it will be asynchronous and will return a Future of type int, and take the ShoppingList object that needs to be deleted.
- Inside the method, we need ...