Step 4

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.173.242