I have finally made my bagel order test app. I can load bagels from json file. Building a list and display on screen. I have added cubit to mange the bagel total state All this works fine.
But I new I would run into this next problem as I was getting cubit state working.
When I select + to increment from 0 to 1 for plain bagels. see pix attached first is start of app. all bagel counts are set to zero, after pressing + 3 times, they all update to 3 . All the count fields update. I understand right now they all have the same field name used in cubit.
I looking for suggestion on how to fix this.
- old school i assign a unique name to each generate item in the listview for bagel total. But how would i use cubit to manage state?
- I started reading about maybe using Keys, but they seem to me not to be the answer.
- I know each item in the list has a unique index. As I have display on the app for testing.
I increment plain bagel and all bagels are updated. So what would be the correct way to address this?
thanks new to flutter/dart so getting my feet wet...
incremented shows all going from zero to 3 [1]: https://i.stack.imgur.com/7N6Gp.png