From 3e064bebdedad71f6820f241257d960683cbf115 Mon Sep 17 00:00:00 2001 From: Ildeberto Vasconcelos Date: Sun, 7 Dec 2025 22:44:57 +0000 Subject: [PATCH 1/3] =?UTF-8?q?glossary=20link=20for=20=E2=80=98obviously?= =?UTF-8?q?=20typed=E2=80=99=20in=20omit=5Fobvious=5F*=5Ftypes=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/linter/messages.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/linter/messages.yaml b/pkg/linter/messages.yaml index 30a3fc20cd03..f4f33d75ee23 100644 --- a/pkg/linter/messages.yaml +++ b/pkg/linter/messages.yaml @@ -7741,12 +7741,12 @@ LinterLintCode: categories: [style] hasPublishedDocs: false deprecatedDetails: |- - Don't type annotate initialized local variables when the type is obvious. + Don't type annotate initialized local variables when the type is [obvious](https://dart.dev/resources/glossary#obviously-typed). Local variables, especially in modern code where functions tend to be small, have very little scope. Omitting the type focuses the reader's attention on the more important *name* of the variable and its initialized value. Hence, local - variable type annotations that are obvious should be omitted. + variable type annotations that are [obvious](https://dart.dev/resources/glossary#obviously-typed) should be omitted. **BAD:** ```dart @@ -7815,7 +7815,7 @@ LinterLintCode: hasPublishedDocs: false deprecatedDetails: |- Don't type annotate initialized top-level or static variables when the type is - obvious. + [obvious](https://dart.dev/resources/glossary#obviously-typed). **BAD:** ```dart From d3305cb5cc066288fd469b66cf0065b59dd077db Mon Sep 17 00:00:00 2001 From: Ildeberto Vasconcelos Date: Sun, 7 Dec 2025 22:51:49 +0000 Subject: [PATCH 2/3] =?UTF-8?q?glossary=20link=20for=20=E2=80=98obviously?= =?UTF-8?q?=20typed=E2=80=99=20in=20specify=5Fnonobvious=5Fproperty=5Ftype?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/linter/messages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/linter/messages.yaml b/pkg/linter/messages.yaml index f4f33d75ee23..da7292aca1b8 100644 --- a/pkg/linter/messages.yaml +++ b/pkg/linter/messages.yaml @@ -11955,7 +11955,7 @@ LinterLintCode: hasPublishedDocs: false deprecatedDetails: |- Do type annotate initialized top-level or static variables when the type is - non-obvious. + [non-obvious](https://dart.dev/resources/glossary#obviously-typed). Type annotations on top-level or static variables can serve as a request for type inference, documenting the expected outcome of the type inference step, From 665ed323bdc218f225f0b377e30325ee3b2eb354 Mon Sep 17 00:00:00 2001 From: ildysilva Date: Tue, 9 Dec 2025 23:26:50 +0100 Subject: [PATCH 3/3] clarify guidance and remove redudant content --- pkg/linter/messages.yaml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/pkg/linter/messages.yaml b/pkg/linter/messages.yaml index da7292aca1b8..36bc8806a9b4 100644 --- a/pkg/linter/messages.yaml +++ b/pkg/linter/messages.yaml @@ -11969,28 +11969,6 @@ LinterLintCode: information about the type of the given variable (which may not be immediately evident by looking at the initializing expression). - An expression is considered to have a non-obvious type when it does not - have an obvious type. - - An expression e has an obvious type in the following cases: - - - e is a non-collection literal. For instance, 1, true, 'Hello, $name!'. - - e is a collection literal with actual type arguments. For instance, - {}. - - e is a list literal or a set literal where at least one element has an - obvious type, and all elements have the same type. For instance, [1, 2] and - { [true, false], [] }, but not [1, 1.5]. - - e is a map literal where all key-value pair have a key with an obvious type - and a value with an obvious type, and all keys have the same type, and all - values have the same type. For instance, { #a: [] }, but not - {1: 1, 2: true}. - - e is an instance creation expression whose class part is not raw. For - instance C(14) if C is a non-generic class, or C(14) if C accepts one - type argument, but not C(14) if C accepts one or more type arguments. - - e is a cascade whose target has an obvious type. For instance, - 1..isEven..isEven has an obvious type because 1 has an obvious type. - - e is a type cast. For instance, `myComplexExpression as int`. - **BAD:** ```dart final myTopLevelVariable =