A dismissed Dismissible widget is still part of the tree


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

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.


@vguzzi any suggestions?


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!

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

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


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

File: grocery_manager.dart


@lauragales Oh! Thank you. :pray:

1 Like