So I tried to dynamically update an individual listview item. I am using a function to generate each item and I created a local variable in that function. I used setstate to update that variable but the UI is not updating. If i make the same variable global it works but i changes every listview items which I dont want. Does anyone have any tips on doing that? I am new to flutter and Sorry if this has been asked multiple times. I tried searching but couldnt find any solutions. This is a similar code for the item builder function.
Widget generateListItem(){
bool flag= false;
return InkWell(
onTap:(){
setState((){
flag=true;
})
},
child: Text(flag? "Changed" : "Not Changed"),
);
}
Stateclass instead of inside the method. @Bikramgurung