【发布时间】:2022-08-22 14:39:08
【问题描述】:
我有一个学生班
class Student{
String? name;
String? section;
Student(this.name,this.section);
@override
bool operator == (Object other){
return other is Student && other.name == name && other.section == section;
}
@override
int get hashCode => name.hashCode & section.hashCode;
}
List<Student> studentsOne = [
Student(\"maverick\",\"A\"),
Student(\"roger\",\"A\"),
Student(\"kenny\",\"B\"),
Student(\"kooper\",\"A\")
];
List<Student> studentsTwo = [
Student(\"maverick\",\"A\"),
Student(\"roger\",\"A\"),
Student(\"kenny\",\"B\"),
Student(\"kooper\",\"A\")
];
print(studentsOne == studentsTwo); // prints false
你能帮忙的话,我会很高兴。提前致谢
标签: flutter list dart collections compare