Skip to content

Commit e81bc24

Browse files
kevmooCommit Queue
authored and
Commit Queue
committed
[pkg:meta] deprecate Required
And a bit of other lint-ish cleanup Change-Id: I515d37706c48acff69151e075667c7e4426a742d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424161 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Auto-Submit: Kevin Moore <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent f75a803 commit e81bc24

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

pkg/analyzer/lib/src/dart/analysis/index.dart

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import 'package:analyzer/src/dart/element/element.dart';
1313
import 'package:analyzer/src/summary/format.dart';
1414
import 'package:analyzer/src/summary/idl.dart';
1515
import 'package:collection/collection.dart';
16-
import 'package:meta/meta.dart';
1716

1817
Element2? declaredParameterElement(SimpleIdentifier node, Element2? element) {
1918
if (element == null || element.enclosingElement2 != null) {
@@ -157,9 +156,9 @@ class ElementNameComponents {
157156
}
158157

159158
ElementNameComponents._({
160-
@required this.parameterName,
161-
@required this.classMemberName,
162-
@required this.unitMemberName,
159+
required this.parameterName,
160+
required this.classMemberName,
161+
required this.unitMemberName,
163162
});
164163
}
165164

pkg/meta/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 1.16.1-wip
22

3+
- Mark `Required` and `required` as `@Deprecated`.
34
- Update SDK constraints to `^3.5.0`.
45

56
## 1.16.0

pkg/meta/analysis_options.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ include: package:lints/recommended.yaml
33
linter:
44
rules:
55
- flutter_style_todos
6-
- unnecessary_ignore
6+
- lines_longer_than_80_chars
7+
- prefer_single_quotes
8+
- unnecessary_ignore

pkg/meta/lib/meta.dart

+15-7
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ const _Checked checked = _Checked();
8585
///
8686
/// * the annotation is associated with anything other than a library, class,
8787
/// method or getter, top-level getter or function, or
88-
/// * an invocation of a member that has this annotation is returned by a method,
88+
/// * an invocation of a member that has this annotation is returned by a
89+
/// function or getter that is not similarly annotated as method,
8990
/// getter or function that is not similarly annotated as `doNotStore`, or
9091
/// * an invocation of a member that has this annotation is assigned to a field
9192
/// or top-level variable.
@@ -450,12 +451,16 @@ const _Reopen reopen = _Reopen();
450451
/// * an invocation of a method or function does not include an argument
451452
/// corresponding to a named parameter that has this annotation.
452453
///
453-
/// **Deprecated:** This annotation is set to be deprecated and later
454-
/// removed in a future release of `package:meta`.
454+
/// **Deprecated:** This annotation is set to be removed in a future release of
455+
/// `package:meta`.
456+
///
455457
/// In Dart 2.12 and later, use the built-in `required` keyword
456458
/// to mark a named parameter as required.
457459
/// To learn more about `required`, check out the documentation on
458460
/// [named parameters](https://dart.dev/language/functions#named-parameters).
461+
@Deprecated(
462+
'In Dart 2.12 and later, use the built-in `required` keyword to mark a '
463+
'named parameter as required.')
459464
const Required required = Required();
460465

461466
/// Annotation marking a class as not allowed as a super-type
@@ -553,21 +558,24 @@ class RecordUse {
553558
/// Creates a [RecordUse] instance.
554559
///
555560
/// This annotation can be placed as an annotation on functions whose
556-
/// statically resolved calls should be registered together with the optional
557-
/// [metadata] information.
561+
/// statically resolved calls should be registered
558562
const RecordUse();
559563
}
560564

561565
/// Used to annotate a named parameter `p` in a method or function `f`.
562566
///
563567
/// See [required] for more details.
564568
///
565-
/// **Deprecated:** This annotation is set to be deprecated and later
566-
/// removed in a future release of `package:meta`.
569+
/// **Deprecated:** This annotation is set to be removed in a future release of
570+
/// `package:meta`.
571+
///
567572
/// In Dart 2.12 and later, use the built-in `required` keyword
568573
/// to mark a named parameter as required.
569574
/// To learn more about `required`, check out the documentation on
570575
/// [named parameters](https://dart.dev/language/functions#named-parameters).
576+
@Deprecated(
577+
'In Dart 2.12 and later, use the built-in `required` keyword to mark a '
578+
'named parameter as required.')
571579
class Required {
572580
/// A human-readable explanation of the reason why the annotated parameter is
573581
/// required. For example, the annotation might look like:

0 commit comments

Comments
 (0)