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

Side by Side Diff: pkg/meta/lib/meta.dart

Issue 1770653002: Add an optional parameter to the Required annotation (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | 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) 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 such as `@protected`. 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
11 /// of a function that's been marked `@deprecated`, or it might display the 11 /// of a function that's been marked `@deprecated`, or it might display the
12 /// function's name differently. 12 /// function's name differently.
13 /// 13 ///
14 /// For information on installing and importing this library, see the 14 /// For information on installing and importing this library, see the
15 /// [meta package on pub.dartlang.org] (http://pub.dartlang.org/packages/meta). 15 /// [meta package on pub.dartlang.org] (http://pub.dartlang.org/packages/meta).
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 /// corresponding to `p`, despite the fact that `p` would otherwise be an 77 /// corresponding to `p`, despite the fact that `p` would otherwise be an
78 /// optional parameter. 78 /// optional parameter.
79 /// 79 ///
80 /// Tools, such as the analyzer, can provide feedback if 80 /// Tools, such as the analyzer, can provide feedback if
81 /// * the annotation is associated with anything other than a named parameter, 81 /// * the annotation is associated with anything other than a named parameter,
82 /// * the annotation is associated with a named parameter in a method `m1` that 82 /// * the annotation is associated with a named parameter in a method `m1` that
83 /// overrides a method `m0` and `m0` defines a named parameter with the same 83 /// overrides a method `m0` and `m0` defines a named parameter with the same
84 /// name that does not have this annotation, or 84 /// name that does not have this annotation, or
85 /// * an invocation of a method or function does not include an argument 85 /// * an invocation of a method or function does not include an argument
86 /// corresponding to a named parameter that has this annotation. 86 /// corresponding to a named parameter that has this annotation.
87 const _Required required = const _Required(); 87 const Required required = const Required();
88
89 /// Used to annotate a named parameter `p` in a method or function `f`.
90 ///
91 /// See [required] for more details.
92 class Required {
93 /// A human-readable explanation of the reason why the annotated parameter is
94 /// required. For example, the annotation might look like:
95 ///
96 /// ButtonWidget({
97 /// Function onHover,
98 /// @Required('Buttons must do something when pressed')
99 /// Function onPressed,
100 /// ...
101 /// }) ...
102 final String reason;
103
104 /// Initialize a newly created instance to have the given [reason].
105 const Required([this.reason]);
106 }
88 107
89 class _Factory { 108 class _Factory {
90 const _Factory(); 109 const _Factory();
91 } 110 }
92 111
93 class _Literal { 112 class _Literal {
94 const _Literal(); 113 const _Literal();
95 } 114 }
96 115
97 class _MustCallSuper { 116 class _MustCallSuper {
98 const _MustCallSuper(); 117 const _MustCallSuper();
99 } 118 }
100 119
101 class _Protected { 120 class _Protected {
102 const _Protected(); 121 const _Protected();
103 } 122 }
104
105 class _Required {
106 const _Required();
107 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698