Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: pkg/observe/lib/src/list_path_observer.dart

Issue 53743002: introduce ObservableList.listChanges to keep list changes separate from property changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/observe/lib/src/list_diff.dart ('k') | pkg/observe/lib/src/observable_list.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/src/list_path_observer.dart
diff --git a/pkg/observe/lib/src/list_path_observer.dart b/pkg/observe/lib/src/list_path_observer.dart
index e67f9d3f87e1c99e1c05f8326b10a569ba0bbe90..5c7f1be21b26d0553682f5a301b1d78501e8266d 100644
--- a/pkg/observe/lib/src/list_path_observer.dart
+++ b/pkg/observe/lib/src/list_path_observer.dart
@@ -26,11 +26,10 @@ class ListPathObserver<E, P> extends ChangeNotifier {
ListPathObserver(this.list, String path)
: _itemPath = path {
- _sub = list.changes.listen((records) {
+ // TODO(jmesserly): delay observation until we are observed.
+ _sub = list.listChanges.listen((records) {
for (var record in records) {
- if (record is ListChangeRecord) {
- _observeItems(record.addedCount - record.removedCount);
- }
+ _observeItems(record.addedCount - record.removed.length);
}
_scheduleReduce(null);
});
« no previous file with comments | « pkg/observe/lib/src/list_diff.dart ('k') | pkg/observe/lib/src/observable_list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698