how to compare two objects in flutter
E.g.
class Student {
final String name;
final int age;
Student(this.name, this.age);
@override
bool operator ==(other) {
return (other is Student)
&& other.name == name
&& other.age == age;
}
}
void compareObjects() {
final s1 = Student('Alice', 25);
final s2 = Student('Alice', 20);
print(s1 == s2); // -> true
}