@@ -24144,18 +24144,124 @@ WarningCode:
24144
24144
problemMessage: "Doc imports can't be deferred."
24145
24145
correctionMessage: Try removing the 'deferred' keyword.
24146
24146
hasPublishedDocs: false
24147
+ documentation: |-
24148
+ #### Description
24149
+
24150
+ The analyzer produces this diagnostic when a documentation import uses the
24151
+ `deferred` keyword.
24152
+
24153
+ Documentation imports can't be deferred because deferring them wouldn't
24154
+ impact the size of the compiled code.
24155
+
24156
+ #### Example
24157
+
24158
+ The following code produces this diagnostic because the documentation
24159
+ import has a `deferred` keyword:
24160
+
24161
+ ```dart
24162
+ // ignore:missing_prefix_in_deferred_import
24163
+ /// @docImport 'package:meta/meta.dart' [!deferred!];
24164
+ library;
24165
+ ```
24166
+
24167
+ #### Common fixes
24168
+
24169
+ Remove the `deferred` keyword:
24170
+
24171
+ ```dart
24172
+ /// @docImport 'package:meta/meta.dart';
24173
+ library;
24174
+ ```
24147
24175
DOC_IMPORT_CANNOT_HAVE_COMBINATORS:
24148
24176
problemMessage: "Doc imports can't have show or hide combinators."
24149
24177
correctionMessage: Try removing the combinator.
24150
24178
hasPublishedDocs: false
24179
+ documentation: |-
24180
+ #### Description
24181
+
24182
+ The analyzer produces this diagnostic when a documentation import has one
24183
+ or more `hide` or `show` combinators.
24184
+
24185
+ Using combinators isn't supported for documentation imports.
24186
+
24187
+ #### Example
24188
+
24189
+ The following code produces this diagnostic because the documentation
24190
+ import has a `show` combinator:
24191
+
24192
+ ```dart
24193
+ /// @docImport 'package:meta/meta.dart' [!show max!];
24194
+ library;
24195
+ ```
24196
+
24197
+ #### Common fixes
24198
+
24199
+ Remove the `hide` and `show` combinators:
24200
+
24201
+ ```dart
24202
+ /// @docImport 'package:meta/meta.dart';
24203
+ library;
24204
+ ```
24151
24205
DOC_IMPORT_CANNOT_HAVE_CONFIGURATIONS:
24152
24206
problemMessage: "Doc imports can't have configurations."
24153
24207
correctionMessage: Try removing the configurations.
24154
24208
hasPublishedDocs: false
24209
+ documentation: |-
24210
+ #### Description
24211
+
24212
+ The analyzer produces this diagnostic when a documentation import has one
24213
+ or more `if` clauses.
24214
+
24215
+ Documentation imports aren't configurable.
24216
+
24217
+ #### Example
24218
+
24219
+ The following code produces this diagnostic because the documentation
24220
+ import has an `if` clause:
24221
+
24222
+ ```dart
24223
+ /// @docImport 'package:meta/meta.dart' [!if (dart.library.io) 'dart:io'!];
24224
+ library;
24225
+ ```
24226
+
24227
+ #### Common fixes
24228
+
24229
+ Remove the `if` clauses:
24230
+
24231
+ ```dart
24232
+ /// @docImport 'package:meta/meta.dart';
24233
+ library;
24234
+ ```
24155
24235
DOC_IMPORT_CANNOT_HAVE_PREFIX:
24156
24236
problemMessage: "Doc imports can't have prefixes."
24157
24237
correctionMessage: Try removing the prefix.
24158
24238
hasPublishedDocs: false
24239
+ documentation: |-
24240
+ #### Description
24241
+
24242
+ The analyzer produces this diagnostic when a documentation import has a
24243
+ prefix.
24244
+
24245
+ Using prefixes isn't supported for documentation imports.
24246
+
24247
+ #### Example
24248
+
24249
+ The following code produces this diagnostic because the documentation
24250
+ import declares a prefix:
24251
+
24252
+ ```dart
24253
+ /// @docImport 'package:meta/meta.dart' as [!a!];
24254
+ library;
24255
+ ```
24256
+
24257
+ #### Common fixes
24258
+
24259
+ Remove the prefix:
24260
+
24261
+ ```dart
24262
+ /// @docImport 'package:meta/meta.dart';
24263
+ library;
24264
+ ```
24159
24265
DUPLICATE_EXPORT:
24160
24266
problemMessage: Duplicate export.
24161
24267
correctionMessage: Try removing all but one export of the library.
@@ -25240,6 +25346,47 @@ WarningCode:
25240
25346
Parameters:
25241
25347
0: the name of the member
25242
25348
1: the name of the defining class
25349
+ documentation: |-
25350
+ #### Description
25351
+
25352
+ The analyzer produces this diagnostic when a getter, setter, field, or
25353
+ method that has been annotated with `@protected` is referenced anywhere
25354
+ other than in the library in which it is declared or in a subclass of the
25355
+ class in which it is declared.
25356
+
25357
+ #### Example
25358
+
25359
+ Given a file `a.dart` that contains
25360
+
25361
+ ```dart
25362
+ %uri="lib/a.dart"
25363
+ import 'package:meta/meta.dart';
25364
+
25365
+ class A {
25366
+ @protected
25367
+ void a() {}
25368
+ }
25369
+ ```
25370
+
25371
+ The following code produces this diagnostic because the method `a` is
25372
+ being invoked in code that isn't in a subclass of `A`:
25373
+
25374
+ ```dart
25375
+ import 'a.dart';
25376
+
25377
+ void b(A a) {
25378
+ a.[!a!]();
25379
+ }
25380
+ ```
25381
+
25382
+ #### Common fixes
25383
+
25384
+ If it's reasonable for the member to be marked as `@protected`, then
25385
+ remove the reference to the protected member, replacing it with some
25386
+ equivalent code.
25387
+
25388
+ If it isn't reasonable for the member to be marked as `@protected`, and
25389
+ you have the ability to do so, remove the annotation.
25243
25390
INVALID_USE_OF_VISIBLE_FOR_OVERRIDING_MEMBER:
25244
25391
problemMessage: "The member '{0}' can only be used for overriding."
25245
25392
hasPublishedDocs: true
@@ -25578,6 +25725,49 @@ WarningCode:
25578
25725
did not reopen any type.
25579
25726
25580
25727
No parameters.
25728
+ documentation: |-
25729
+ #### Description
25730
+
25731
+ The analyzer produces this diagnostic when a `@reopen` annotation has been
25732
+ placed on a class or mixin that does not remove restrictions placed on the
25733
+ superclass.
25734
+
25735
+ #### Example
25736
+
25737
+ The following code produces this diagnostic because the class `B` is
25738
+ annotated with `@reopen` even though it doesn't expand the ability of `A`
25739
+ to be subclassed:
25740
+
25741
+ ```dart
25742
+ import 'package:meta/meta.dart';
25743
+
25744
+ sealed class A {}
25745
+
25746
+ @[!reopen!]
25747
+ class B extends A {}
25748
+ ```
25749
+
25750
+ #### Common fixes
25751
+
25752
+ If the superclass should be restricted in a way that the subclass would
25753
+ change, then modify the superclass to reflect those restrictions:
25754
+
25755
+ ```dart
25756
+ import 'package:meta/meta.dart';
25757
+
25758
+ interface class A {}
25759
+
25760
+ @reopen
25761
+ class B extends A {}
25762
+ ```
25763
+
25764
+ If the superclass is correct, then remove the annotation:
25765
+
25766
+ ```dart
25767
+ sealed class A {}
25768
+
25769
+ class B extends A {}
25770
+ ```
25581
25771
INVALID_SEALED_ANNOTATION:
25582
25772
removedIn: "3.5"
25583
25773
problemMessage: "The annotation '@sealed' can only be applied to classes."
@@ -26228,6 +26418,36 @@ WarningCode:
26228
26418
correctionMessage: Try using a non-nullable type.
26229
26419
hasPublishedDocs: false
26230
26420
comment: No parameters.
26421
+ documentation: |-
26422
+ #### Description
26423
+
26424
+ The analyzer produces this diagnostic when an override of the operator
26425
+ `==` has a parameter whose type is nullable. The language spec makes it
26426
+ impossible for the argument of the method to be `null`, and the
26427
+ parameter's type should reflect that.
26428
+
26429
+ #### Example
26430
+
26431
+ The following code produces this diagnostic because the implementation of
26432
+ the operator `==` in `C` :
26433
+
26434
+ ```dart
26435
+ class C {
26436
+ @override
26437
+ bool operator [!==!](Object? other) => false;
26438
+ }
26439
+ ```
26440
+
26441
+ #### Common fixes
26442
+
26443
+ Make the parameter type be non-nullable:
26444
+
26445
+ ```dart
26446
+ class C {
26447
+ @override
26448
+ bool operator ==(Object other) => false;
26449
+ }
26450
+ ```
26231
26451
NULLABLE_TYPE_IN_CATCH_CLAUSE:
26232
26452
problemMessage: "A potentially nullable type can't be used in an 'on' clause because it isn't valid to throw a nullable expression."
26233
26453
correctionMessage: Try using a non-nullable type.
@@ -27939,6 +28159,32 @@ WarningCode:
27939
28159
correctionMessage: Try removing the wildcard pattern.
27940
28160
hasPublishedDocs: false
27941
28161
comment: No parameters.
28162
+ documentation: |-
28163
+ #### Description
28164
+
28165
+ The analyzer produces this diagnostic when a wildcard pattern is used in
28166
+ either an and (`&&`) pattern or an or (`||`) pattern.
28167
+
28168
+ #### Example
28169
+
28170
+ The following code produces this diagnostic because the wildcard pattern
28171
+ (`_`) will always succeed, making it's use in an and pattern unnecessary:
28172
+
28173
+ ```dart
28174
+ void f(Object? x) {
28175
+ if (x case [!_!] && 0) {}
28176
+ }
28177
+ ```
28178
+
28179
+ #### Common fixes
28180
+
28181
+ Remove the use of the wildcard pattern:
28182
+
28183
+ ```dart
28184
+ void f(Object? x) {
28185
+ if (x case 0) {}
28186
+ }
28187
+ ```
27942
28188
UNREACHABLE_SWITCH_CASE:
27943
28189
problemMessage: "This case is covered by the previous cases."
27944
28190
correctionMessage: Try removing the case clause, or restructuring the preceding patterns.
0 commit comments