Created
November 14, 2019 02:58
-
-
Save felangel/67947cf4a56f645b280add5abdcbeb3b to your computer and use it in GitHub Desktop.
Equatable HashCode Sample
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
import './point1.dart' as point1; | |
import './point2.dart' as point2; | |
void main() { | |
final p1 = point1.Point(); | |
final p2 = point2.Point(); | |
print(p1 == p2); // false | |
print(p1.hashCode == p2.hashCode); // false | |
} |
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
import 'package:equatable/equatable.dart'; | |
class Point extends Equatable { | |
final int x = 4; | |
final int y = 3; | |
@override | |
List<Object> get props => [x, y]; | |
} |
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
import 'package:equatable/equatable.dart'; | |
class Point extends Equatable { | |
final int y = 3; | |
final int x = 4; | |
@override | |
List<Object> get props => [y, x]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment