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

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

Issue 51483002: fix PathObserver to avoid try+catch (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/bind_property.dart ('k') | pkg/observe/lib/src/change_record.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/src/change_notifier.dart
diff --git a/pkg/observe/lib/src/change_notifier.dart b/pkg/observe/lib/src/change_notifier.dart
index a51fda6e8c4526396cda3e99ab02d5f31f985204..133c6c88cb7c9a2ab9e744337045833debcdd10a 100644
--- a/pkg/observe/lib/src/change_notifier.dart
+++ b/pkg/observe/lib/src/change_notifier.dart
@@ -2,7 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of observe;
+library observe.src.change_notifier;
+
+import 'dart:async';
+import 'dart:collection' show UnmodifiableListView;
+import 'package:observe/observe.dart';
+import 'package:observe/src/observable.dart' show notifyPropertyChangeHelper;
/**
* Mixin and base class for implementing an [Observable] object that performs
@@ -19,7 +24,7 @@ abstract class ChangeNotifier implements Observable {
Stream<List<ChangeRecord>> get changes {
if (_changes == null) {
_changes = new StreamController.broadcast(sync: true,
- onListen: _observed, onCancel: _unobserved);
+ onListen: observed, onCancel: unobserved);
}
return _changes.stream;
}
@@ -29,13 +34,13 @@ abstract class ChangeNotifier implements Observable {
/**
* Override this method to be called when the [changes] are first observed.
*/
- void _observed() {}
+ void observed() {}
/**
* Override this method to be called when the [changes] are no longer being
* observed.
*/
- void _unobserved() {}
+ void unobserved() {}
bool deliverChanges() {
var records = _records;
@@ -69,7 +74,7 @@ abstract class ChangeNotifier implements Observable {
* }
*/
notifyPropertyChange(Symbol field, Object oldValue, Object newValue)
- => _notifyPropertyChange(this, field, oldValue, newValue);
+ => notifyPropertyChangeHelper(this, field, oldValue, newValue);
void notifyChange(ChangeRecord record) {
if (!hasObservers) return;
« no previous file with comments | « pkg/observe/lib/src/bind_property.dart ('k') | pkg/observe/lib/src/change_record.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698