Minor fixes and re-add PropertyChangeRecord equality. (#87)
* Add toString close brackets and re-add PropertyChangeRecord equality.
* Remove unnecessary quotes from pubspec.
* Fix lints.
* Simplify equality calculation.
* Bump to a dev version.
* Use the correct Map type for ObservableMap.linked
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f318ea..0e810aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.22.3-dev
+
+* Reintroduce custom equality for `PropertyChangeRecord` from 0.18.0.
+
## 0.22.2
* Add `toObservableList` and `toObservableMap`, better typed versions of
diff --git a/lib/src/records/map_change_record.dart b/lib/src/records/map_change_record.dart
index cd37fc9..dc252d2 100644
--- a/lib/src/records/map_change_record.dart
+++ b/lib/src/records/map_change_record.dart
@@ -77,6 +77,6 @@
@override
String toString() {
final kind = isInsert ? 'insert' : isRemove ? 'remove' : 'set';
- return '#<MapChangeRecord $kind $key from $oldValue to $newValue';
+ return '#<MapChangeRecord $kind $key from $oldValue to $newValue>';
}
}
diff --git a/lib/src/records/property_change_record.dart b/lib/src/records/property_change_record.dart
index 74566d5..24c9bf6 100644
--- a/lib/src/records/property_change_record.dart
+++ b/lib/src/records/property_change_record.dart
@@ -26,6 +26,17 @@
);
@override
+ bool operator ==(Object o) =>
+ o is PropertyChangeRecord<T> &&
+ identical(object, o.object) &&
+ name == o.name &&
+ oldValue == o.oldValue &&
+ newValue == o.newValue;
+
+ @override
+ int get hashCode => hash4(object, name, oldValue, newValue);
+
+ @override
String toString() => ''
- '#<$PropertyChangeRecord $name from $oldValue to: $newValue';
+ '#<$PropertyChangeRecord $name from $oldValue to: $newValue>';
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 8bfa5ac..ea1cc9f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: observable
-version: 0.22.2
+version: 0.22.3-dev
author: Dart Team <misc@dartlang.org>
description: Support for marking objects as observable
homepage: https://github.com/dart-lang/observable
@@ -17,5 +17,5 @@
build_test: ^0.10.0
build_web_compilers: '>=0.3.1 <3.0.0'
dart_style: ^1.0.9
- pedantic: '^1.4.0'
+ pedantic: ^1.4.0
test: ^1.3.0