In the majority of the Dismissible examples provided by Flutter, they are dismissing items within a ListView. For example, this.
What I am currently doing is this:
simplest way 1-> set unique id for each item of list with
var uuid = new Uuid();
new MyItem(title: "Sanjay Singh Bisht",color:"#123ab",uniqueId:uuid.v1()));
as mentioned in above post Dismissible widget required unique id
2-> now to delete item its simple
if (items.contains(deletedItem)) {
setState(() {
items.remove(deletedItem);
});
}
3- to undo delete item just update that item id so that Dismissible widget has unique id always
setState(() {
deletedItem.uniqueId=uuid.v1();
});