Flutter Dismissible insists list item must be removed from tree

Posted by Andre Scott | Updated on

Flutter Dismissible insists list item must be removed from tree. The Dismissible will think your item was dismissed as long as the item key changes. Let’s say your item class is MyItem. If you implement a constructor MyItem.from in your MyItem class that copies the fields over, example:

Then you can replace handleUndo(item) with handleUndo(new MyItem.from(item)) so that your new ObjectKey(item) will be unique from the old ObjectKey that you used before (assuming you didn’t implement operator == on MyItem).


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers