Created
February 14, 2022 12:24
-
-
Save lesnitsky/df38fc1c4a64d207e0213953d8bd5814 to your computer and use it in GitHub Desktop.
This file contains 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 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