Chapter 9/ Remove an item from previous searches

In Chapter 9 → building the popup menu for previous searches:

In the callback of CustomDropdownMenuItem after we remove the item from the previousSearches list we didn’t call savePreviousSearches(); so the removed item will stay in the shared_prefs, this seems incorrect for me, do I miss something?

1 Like

anyone have an idea?

I had the same question. As you mentioned in your question, I added savePreviousSearches(); in the callback of CustomDropdownMenuItem in _buildSearchCard() in recipe_list.dart.
Now, after I remove an item and stop the app, and when I start it again, the list does not have the removed item.
Thanks for sharing !

1 Like