Skip to content

Commit 4b92abe

Browse files
authored
Add .equals() (#16)
* Add .equals() * Fix value to be checked * Add @deprecated for .equals()
1 parent 1274905 commit 4b92abe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/src/tinycolor.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,17 @@ class TinyColor {
161161
Color get color {
162162
return _color;
163163
}
164+
165+
@override
166+
bool operator ==(Object other) =>
167+
identical(this, other) ||
168+
other is TinyColor &&
169+
runtimeType == other.runtimeType &&
170+
color == other.color;
171+
172+
@override
173+
int get hashCode => name.hashCode;
174+
175+
@Deprecated('Use == instead.')
176+
bool equals(Object other) => this == other;
164177
}

0 commit comments

Comments
 (0)