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

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

Issue 1616953004: Fixed strong mode errors and warnings reachable from lib/observe.dart (Closed) Base URL: https://github.com/dart-lang/observe.git@master
Patch Set: Reformat Created 4 years, 11 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
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 library observe.src.observable_box; 5 library observe.src.observable_box;
6 6
7 import 'package:observe/observe.dart'; 7 import 'package:observe/observe.dart';
8 8
9 // TODO(jmesserly): should the property name be configurable? 9 // TODO(jmesserly): should the property name be configurable?
10 // That would be more convenient. 10 // That would be more convenient.
11 /// An observable box that holds a value. Use this if you want to store a single 11 /// An observable box that holds a value. Use this if you want to store a single
12 /// value. For other cases, it is better to use [ObservableList], 12 /// value. For other cases, it is better to use [ObservableList],
13 /// [ObservableMap], or a custom [Observable] implementation based on 13 /// [ObservableMap], or a custom [Observable] implementation based on
14 /// [Observable]. The property name for changes is "value". 14 /// [Observable]. The property name for changes is "value".
15 class ObservableBox<T> extends ChangeNotifier { 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) as T;
vsm 2016/01/22 16:47:15 Another cast from dynamic.
Jennifer Messerly 2016/01/22 17:45:00 this one too could be either generic method for no
vsm 2016/01/22 18:49:22 Done.
24 } 24 }
25 25
26 String toString() => '#<$runtimeType value: $value>'; 26 String toString() => '#<$runtimeType value: $value>';
27 } 27 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698