Committed by
GitHub
Merge pull request #531 from roipeker/master
Rx equality fix
Showing
1 changed file
with
5 additions
and
1 deletions
@@ -106,13 +106,17 @@ class _RxImpl<T> implements RxInterface<T> { | @@ -106,13 +106,17 @@ class _RxImpl<T> implements RxInterface<T> { | ||
106 | String toString() => value.toString(); | 106 | String toString() => value.toString(); |
107 | 107 | ||
108 | /// This equality override works for _RxImpl instances and the internal values. | 108 | /// This equality override works for _RxImpl instances and the internal values. |
109 | - bool operator ==(o) { | 109 | + @override |
110 | + bool operator ==(dynamic o) { | ||
110 | // Todo, find a common implementation for the hashCode of different Types. | 111 | // Todo, find a common implementation for the hashCode of different Types. |
111 | if (o is T) return _value == o; | 112 | if (o is T) return _value == o; |
112 | if (o is _RxImpl<T>) return _value == o.value; | 113 | if (o is _RxImpl<T>) return _value == o.value; |
113 | return false; | 114 | return false; |
114 | } | 115 | } |
115 | 116 | ||
117 | + @override | ||
118 | + int get hashCode => _value.hashCode; | ||
119 | + | ||
116 | void close() { | 120 | void close() { |
117 | _subscriptions.forEach((observable, subscription) => subscription.cancel()); | 121 | _subscriptions.forEach((observable, subscription) => subscription.cancel()); |
118 | _subscriptions.clear(); | 122 | _subscriptions.clear(); |
-
Please register or login to post a comment