Skip to content

Instantly share code, notes, and snippets.

@fredgrott
Created April 7, 2025 00:20
Show Gist options
  • Save fredgrott/84fcc34daec0bb6d71c957a113ff951d to your computer and use it in GitHub Desktop.
Save fredgrott/84fcc34daec0bb6d71c957a113ff951d to your computer and use it in GitHub Desktop.
person value class example
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