Skip to content

Instantly share code, notes, and snippets.

@lesnitsky
Created February 14, 2022 12:24
Show Gist options
  • Save lesnitsky/df38fc1c4a64d207e0213953d8bd5814 to your computer and use it in GitHub Desktop.
Save lesnitsky/df38fc1c4a64d207e0213953d8bd5814 to your computer and use it in GitHub Desktop.
class Comparable {
final String content;
Comparable(this.content);
@override
bool operator ==(other) {
print('==');
return other is Comparable && other.hashCode == hashCode;
}
@override
int get hashCode {
print('get hashCode');
return content.hashCode;
}
}
void main() {
final a = <Comparable>{ Comparable('a'), Comparable('b'), Comparable('a') };
print(a.length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment