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

Side by Side Diff: pkg/observe/lib/src/observable_box.dart

Issue 27618002: package:observe fix various api issues (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/observe/lib/src/observable.dart ('k') | pkg/observe/lib/src/observable_list.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of observe; 5 part of observe;
6 6
7 // TODO(jmesserly): should the property name be configurable? 7 // TODO(jmesserly): should the property name be configurable?
8 // That would be more convenient. 8 // That would be more convenient.
9 /** 9 /**
10 * An observable box that holds a value. Use this if you want to store a single 10 * An observable box that holds a value. Use this if you want to store a single
11 * value. For other cases, it is better to use [ObservableList], 11 * value. For other cases, it is better to use [ObservableList],
12 * [ObservableMap], or a custom [Observable] implementation based on 12 * [ObservableMap], or a custom [Observable] implementation based on
13 * [ObservableMixin]. The property name for changes is "value". 13 * [Observable]. The property name for changes is "value".
14 */ 14 */
15 class ObservableBox<T> extends ChangeNotifierBase { 15 class ObservableBox<T> extends ChangeNotifier {
16 T _value; 16 T _value;
17 17
18 ObservableBox([T initialValue]) : _value = initialValue; 18 ObservableBox([T initialValue]) : _value = initialValue;
19 19
20 @reflectable T get value => _value; 20 @reflectable T get value => _value;
21 21
22 @reflectable void set value(T newValue) { 22 @reflectable void set value(T newValue) {
23 _value = notifyPropertyChange(#value, _value, newValue); 23 _value = notifyPropertyChange(#value, _value, newValue);
24 } 24 }
25 25
26 String toString() => '#<$runtimeType value: $value>'; 26 String toString() => '#<$runtimeType value: $value>';
27 } 27 }
OLDNEW
« no previous file with comments | « pkg/observe/lib/src/observable.dart ('k') | pkg/observe/lib/src/observable_list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698