unable to update the list of items by text field in a flutter. I am not using APIs or local storage

201 Views Asked by At

unable to update the list of items by text field in a flutter. I am not using APIs or local storage. Only want to dynamically update the data on Screen. enter image description here

for adding items I used this function on button onpressed function

binLocation.add(BinLocation(binLocation: dropdownValues,quantity: quantity));

and for deleting the item, I am using this line of code during the delete button onpressed in the list

onPressed: ()
   {
    setState(() {                                             
      binLocation.remove(binLocation[index]);
   });
  },

Modal class

class BinLocation {

  final String binLocation;   final String quantity;

  BinLocation ({this.binLocation,this.quantity});

}
1

There are 1 best solutions below

1
Tearf001 On
// change to plural binLocations 
pluralbinLocations[index] = udpateLocation; 

not work? I'v tried it using flutter demo app, it worked

 final aa = [1];

  void _incrementCounter() {
    setState(() {.
      _counter++;
      aa[0]++;
    });
  }