# A dismissed Dismissible widget is still part of the tree

**URL:** <https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085>\
**Category:** Flutter Apprentice\
**Created:** [May 28, 2022, 3:13pm UTC](https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085 "2022-05-28T15:13:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![isuru](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/isuru/32/104343_2.png) [@isuru](https://forums.kodeco.com/u/isuru)\
**Post date:** [May 28, 2022, 3:13pm UTC](https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085/1 "2022-05-28T15:13:44Z")

</div>

Hi,

I’m working through the chapter 6’s adding Dismissible widget part.

I can swipe to delete and it works fine. But if I tap on the + button right after, the app stop at the following exception

> A dismissed Dismissible widget is still part of the tree.

 ![Screenshot 2022-05-28 at 8.42.57 PM](https://files.chunter.kodeco.com/original/3X/f/3/f3f8203ea2e27f7f42d9f477c3a7bb5869354c16.png)

I copied the code of the grocery\_list\_screen.dart from the final solution to mine and tried again but came across the same error.

I’d appreciate any guidance on how to fix this. I’m running the app in Flutter 2.5.3.

Thanks!

---

<div class="post-metadata">

**Author:** ![robertomachorro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/robertomachorro/32/111603_2.png) [@robertomachorro](https://forums.kodeco.com/u/robertomachorro)\
**Post date:** [May 29, 2022, 7:10pm UTC](https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085/2 "2022-05-29T19:10:19Z")

</div>

@vguzzi any suggestions?

---

<div class="post-metadata">

**Author:** ![jomoka](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jomoka/32/109828_2.png) [@jomoka](https://forums.kodeco.com/u/jomoka)\
**Post date:** [June 2, 2022, 11:41am UTC](https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085/3 "2022-06-02T11:41:16Z")

</div>

@isuru

Can you please double check if you included a `key`?  
You could also try upgrading the package to see if that works!  
Or share your repo and i’ll have a quick look!

```auto
return Dismissible(
            // 6
            key: Key(item.id),
            // 7
            direction: DismissDirection.endToStart,
            // 8
            background: Container(
              color: Colors.red,
              alignment: Alignment.centerRight,
              child: const Icon(
                Icons.delete_forever,
                color: Colors.white,
                size: 50.0,
              ),
            ),

```

---

<div class="post-metadata">

**Author:** ![isuru](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/isuru/32/104343_2.png) [@isuru](https://forums.kodeco.com/u/isuru)\
**Post date:** [June 2, 2022, 12:47pm UTC](https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085/4 "2022-06-02T12:47:38Z")

</div>

Hi @jomoka, I upgraded the `provider` package but no luck. I pushed my repo to my Github. Please check the below link.

[https://github.com/Isuru-Nanayakkara/fooderlich-issue](https://github.com/Isuru-Nanayakkara/fooderlich-issue)

---

<div class="post-metadata">

**Author:** ![lauragales](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lauragales/32/110821_2.png) [@lauragales](https://forums.kodeco.com/u/lauragales)\
**Post date:** [June 2, 2022, 1:02pm UTC](https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085/5 "2022-06-02T13:02:10Z")

</div>

You are missing the function call for `notifyListeners()` in the `deleteItem` function body.

File: `grocery_manager.dart`

---

<div class="post-metadata">

**Author:** ![isuru](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/isuru/32/104343_2.png) [@isuru](https://forums.kodeco.com/u/isuru)\
**Post date:** [June 2, 2022, 1:18pm UTC](https://forums.kodeco.com/t/a-dismissed-dismissible-widget-is-still-part-of-the-tree/172085/6 "2022-06-02T13:18:42Z")

</div>

@lauragales Oh! Thank you. 🙏
