Created
April 7, 2025 00:20
-
-
Save fredgrott/84fcc34daec0bb6d71c957a113ff951d to your computer and use it in GitHub Desktop.
person 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 Person implements Comparable<Person>{ | |
final String name; | |
Person(this.name); | |
String toString() => name; | |
bool operator ==(Object other) => identical(this, other) || other is Person; | |
int get hashCode => name.hasCode; | |
@override | |
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