Created
April 7, 2025 14:22
-
-
Save fredgrott/d0bd099f6a4ace8fa20cf06fc5e3658f to your computer and use it in GitHub Desktop.
student value class example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student implements Comparable<Student> { | |
final String name; | |
const Student(this.name); | |
String toString() => "Student: $name"; | |
bool operator ==(Object other) => | |
identical(this, other) || | |
other is Student && | |
runtimeType == other.runtimeType && | |
name == other.name; | |
int get hashCode => name.hashCode; | |
int compareTo(Student other) => name.compareTo(other.name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment