'How to make sublist to the item in the list which has common
I need to sort common age names as sublist to the same age list item here below is the list which contains age and name , here i want to make sublist names to the same age item , need help
class Details {
final String name;
final int age;
Details(this.name, this.age);
List <Details> list = [
{ Jack, 21},
{ Adam, 22},
{ Katherin, 24},
{ john, 22},
{ mike, 21}
]
}
Expected :
List <Details> list = [
{ 21: ["jack", "mike",]},
{ 22: ["Adam", "john"]},
{ 24: ["Katherin"]}, ]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
