I am creating a POS where i want to show the items purchased as a text and i intent to store those as a text too. I am separating each item by '\n' character.
Now the problem is that i dont know how to check for text which specifically matches a certain product. I have tried using string.contains method but it is not what i desire.
For example: I have products names like:
- Chicken
- Chicken Cheese
Now these are two different products but every chicken cheese is going to contain chicken too in it.
So, How can i replace the product
Products are in a list which are further part of a map. However, for this question; you can assume that all the items are stored as a list, Example below:
['chicken', 120],
['chicken Cheeze', 150],
['chicken Cheeze Pizza', 180],
.......................
Than, down in the code i am saving those products as a string (when tapped upon.).
// Gesture Detector is inside a Galleryview which is further part of a row and expanded widgets,
GestureDetector(
onTap: () {
//bill items is a string Storing all products.
billItems += (item[0] +
' : ' +
item[1].toString() + '\n');
},
P.s: All i want to do is to do something like: "chicken * 3" if chickens are orders 3 times instead of printing it 3 times. Thanks
