i have the following List
List myList = [
{ name : Alex },
{ name : Ali },
{ name : jack },
{ name : Alex },
{ name : Alex },
];
Now i want update all item that the name == Alex to Andy
so i tried the following
int wantedIndex = myList.indexWhere((element) => element[ name ]== Alex );
myList[wantedIndex] = { name : Andy } ;
since the indexWhere
is only get the first target index so it will update one item only.
so How could i achieve this with all item that == Alex ?