I want to store in a variable, the path to an element in a Map for quicker access later on
class Student{
String name;
int age;
Icon icon;
Color color;
Student(this.name, this.age, this.icon, this.color);
}
Student student_1 = Student('James', 14, Icon(Icons.label),Colors.green);
Student student_2 = Student('Andy', 12, Icon(Icons.label),Colors.blue);
Student student_3 = Student('Peter', 13, Icon(Icons.label),Colors.green);
Student student_4 = Student('Cathy', 15, Icon(Icons.label),Colors.pink);
Student student_5 = Student('Pamela', 14, Icon(Icons.label),Colors.amber);
Map<Student,dynamic> mapStudent = {student_1 : [student_2 , {student_3 : [student_4 , student_5,
student_2]}]};
var tmp = mapStudent[student_1][1][student_3][0];
The path I want to store is[student_1][1][student_3]
so I can later access the details in that element without having to go through a loop. Is it possible?
I came across a Class called PathMap class but don't know how to use it or whether it is meant for what I'm trying to achieve. PathMap class