Richard Otabil
 · CEO purposeApps

Quantity Update Affects Wrong Item in Order List Due to Indexing Issue

Actions & Logic

I am creating a POS application for my bar, but whenever an item from the menu is selected, it appears in the order list on the right. However, when I try to update a specific order in the list by increasing or decreasing the quantity, the change is applied to a different item in the list. It seems like the updates are based on the position of the items in the list rather than targeting a specific item in the data structure.

I am using a custom data type, so the updates don’t interact with the database until the order is placed. This is important because the system will be used at the bar, and during peak times, relying heavily on the internet would slow down operations.

As you can see in the video, when the first item moves to the second or third position, changing the quantity only affects the item at index 0 in the list. I’m not sure how to fix this issue. Could you please help?

Screen Recording 2024-10-02 at 12.48.15 AM.mov
12.49MB

What have you tried so far?

The following is my setup - i created a datatype and then an app state variable to add items tapped on into a list or remove when its tapped on again . then on the right i generated children from the datatype variable using the list view. all items tapped are displayed there but the quantity wont change when a specific item is targetted. if it was in a database i am sure i would target it using a ref .

Did you check FlutterFlow's Documentation for this topic?
Yes
2
3 replies