OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// Constants for use in metadata annotations. | 5 /// Constants for use in metadata annotations. |
6 /// | 6 /// |
7 /// See also `@deprecated` and `@override` in the `dart:core` library. | 7 /// See also `@deprecated` and `@override` in the `dart:core` library. |
8 /// | 8 /// |
9 /// Annotations provide semantic information that tools can use to provide a | 9 /// Annotations provide semantic information that tools can use to provide a |
10 /// better user experience. For example, an IDE might not autocomplete the name | 10 /// better user experience. For example, an IDE might not autocomplete the name |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 /// Tools, such as the analyzer, can provide feedback if | 90 /// Tools, such as the analyzer, can provide feedback if |
91 /// | 91 /// |
92 /// * the annotation is associated with anything other than a named parameter, | 92 /// * the annotation is associated with anything other than a named parameter, |
93 /// * the annotation is associated with a named parameter in a method `m1` that | 93 /// * the annotation is associated with a named parameter in a method `m1` that |
94 /// overrides a method `m0` and `m0` defines a named parameter with the same | 94 /// overrides a method `m0` and `m0` defines a named parameter with the same |
95 /// name that does not have this annotation, or | 95 /// name that does not have this annotation, or |
96 /// * an invocation of a method or function does not include an argument | 96 /// * an invocation of a method or function does not include an argument |
97 /// corresponding to a named parameter that has this annotation. | 97 /// corresponding to a named parameter that has this annotation. |
98 const Required required = const Required(); | 98 const Required required = const Required(); |
99 | 99 |
| 100 /// Used to annotate a declaration was made public, so that it is more visible |
| 101 /// than otherwise necessary, to make code testable. |
| 102 /// |
| 103 /// Tools, such as the analyzer, can provide feedback if |
| 104 /// |
| 105 /// * the annotation is associated with a declaration not in the `lib` folder |
| 106 /// of a package; |
| 107 /// or |
| 108 /// * the declaration is referenced outside of its the defining library or a |
| 109 /// library which is in the `test` folder of the defining package. |
| 110 const _VisibleForTesting visibleForTesting = const _VisibleForTesting(); |
| 111 |
100 /// Used to annotate a named parameter `p` in a method or function `f`. | 112 /// Used to annotate a named parameter `p` in a method or function `f`. |
101 /// | 113 /// |
102 /// See [required] for more details. | 114 /// See [required] for more details. |
103 class Required { | 115 class Required { |
104 /// A human-readable explanation of the reason why the annotated parameter is | 116 /// A human-readable explanation of the reason why the annotated parameter is |
105 /// required. For example, the annotation might look like: | 117 /// required. For example, the annotation might look like: |
106 /// | 118 /// |
107 /// ButtonWidget({ | 119 /// ButtonWidget({ |
108 /// Function onHover, | 120 /// Function onHover, |
109 /// @Required('Buttons must do something when pressed') | 121 /// @Required('Buttons must do something when pressed') |
(...skipping 18 matching lines...) Expand all Loading... |
128 const _MustCallSuper(); | 140 const _MustCallSuper(); |
129 } | 141 } |
130 | 142 |
131 class _OptionalTypeArgs { | 143 class _OptionalTypeArgs { |
132 const _OptionalTypeArgs(); | 144 const _OptionalTypeArgs(); |
133 } | 145 } |
134 | 146 |
135 class _Protected { | 147 class _Protected { |
136 const _Protected(); | 148 const _Protected(); |
137 } | 149 } |
| 150 |
| 151 class _VisibleForTesting { |
| 152 const _VisibleForTesting(); |
| 153 } |
OLD | NEW |