Key points:
- The delete helper method of a database object is asynchronous, as with every database task.
- In the delete method, use the where and whereArgs named parameters to filter the data you want to delete.
Solution:
In the DbHelper class of the dbhelper.dart file, add a deleteItem method, as follows:
Future<int> deleteItem(ListItem item) async {
int result = await db.delete("items", where: "id = ?", whereArgs:
[item.id]);
return result;
}
Let's add a Dismissible widget to the items screen, next.