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

Side by Side Diff: lib/src/metadata.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: Removed inferrable type param 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
« no previous file with comments | « lib/src/list_path_observer.dart ('k') | lib/src/observable.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 library observe.src.metadata; 5 library observe.src.metadata;
6 6
7 /// Use `@observable` to make a field automatically observable, or to indicate 7 /// Use `@observable` to make a field automatically observable, or to indicate
8 /// that a property is observable. This only works on classes that extend or 8 /// that a property is observable. This only works on classes that extend or
9 /// mix in `Observable`. 9 /// mix in `Observable`.
10 const ObservableProperty observable = const ObservableProperty(); 10 const ObservableProperty observable = const ObservableProperty();
11 11
12 /// An annotation that is used to make a property observable. 12 /// An annotation that is used to make a property observable.
13 /// Normally this is used via the [observable] constant, for example: 13 /// Normally this is used via the [observable] constant, for example:
14 /// 14 ///
15 /// class Monster extends Observable { 15 /// class Monster extends Observable {
16 /// @observable int health; 16 /// @observable int health;
17 /// } 17 /// }
18 /// 18 ///
19 // TODO(sigmund): re-add this to the documentation when it's really true: 19 // TODO(sigmund): re-add this to the documentation when it's really true:
20 // If needed, you can subclass this to create another annotation that will 20 // If needed, you can subclass this to create another annotation that will
21 // also be treated as observable. 21 // also be treated as observable.
22 // Note: observable properties imply reflectable. 22 // Note: observable properties imply reflectable.
23 class ObservableProperty { 23 class ObservableProperty {
24 const ObservableProperty(); 24 const ObservableProperty();
25 } 25 }
26 26
27
28 /// This can be used to retain any properties that you wish to access with 27 /// This can be used to retain any properties that you wish to access with
29 /// Dart's mirror system. If you import `package:observe/mirrors_used.dart`, all 28 /// Dart's mirror system. If you import `package:observe/mirrors_used.dart`, all
30 /// classes or members annotated with `@reflectable` wil be preserved by dart2js 29 /// classes or members annotated with `@reflectable` wil be preserved by dart2js
31 /// during compilation. This is necessary to make the member visible to 30 /// during compilation. This is necessary to make the member visible to
32 /// `PathObserver`, or similar systems, once the code is deployed, if you are 31 /// `PathObserver`, or similar systems, once the code is deployed, if you are
33 /// not doing a different kind of code-generation for your app. If you are using 32 /// not doing a different kind of code-generation for your app. If you are using
34 /// polymer, you most likely don't need to use this annotation anymore. 33 /// polymer, you most likely don't need to use this annotation anymore.
35 const Reflectable reflectable = const Reflectable(); 34 const Reflectable reflectable = const Reflectable();
36 35
37 /// An annotation that is used to make a type or member reflectable. This makes 36 /// An annotation that is used to make a type or member reflectable. This makes
38 /// it available to `PathObserver` at runtime. For example: 37 /// it available to `PathObserver` at runtime. For example:
39 /// 38 ///
40 /// @reflectable 39 /// @reflectable
41 /// class Monster extends ChangeNotifier { 40 /// class Monster extends ChangeNotifier {
42 /// int _health; 41 /// int _health;
43 /// int get health => _health; 42 /// int get health => _health;
44 /// ... 43 /// ...
45 /// } 44 /// }
46 /// ... 45 /// ...
47 /// // This will work even if the code has been tree-shaken/minified: 46 /// // This will work even if the code has been tree-shaken/minified:
48 /// final monster = new Monster(); 47 /// final monster = new Monster();
49 /// new PathObserver(monster, 'health').changes.listen(...); 48 /// new PathObserver(monster, 'health').changes.listen(...);
50 class Reflectable { 49 class Reflectable {
51 const Reflectable(); 50 const Reflectable();
52 } 51 }
OLDNEW
« no previous file with comments | « lib/src/list_path_observer.dart ('k') | lib/src/observable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698