I have objects which have a parameter name and a parameter counter. Those objects are stores inside a list. Some of the items in my list have the duplicate parameter "name". I want to remove the duplicates inside the list and add the counter of that duplicate to the duplicate-objects parameter.
class Person{
Person({this.name, this.counter)};
String name;
int counter;
}
List<Person> theList = [];
theList.add(Person(name:"Ben", counter: 2);
theList.add(Person(name:"Ben", counter: 5);
//I need a function that changes the List to show Ben with counter 7