-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[all] Omit obvious local types #10511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[all] Omit obvious local types #10511
Conversation
|
@tarrinneal or @bparrishMines please review the non-automated commits (3620b2c, f231a2f, d700b45). Everyone else, please feel free to ignore this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces new linter rules to prefer type inference for obvious local variables and then applies these changes across the entire repository. The changes are extensive but mostly automated, resulting in more concise code by removing explicit type annotations where they are redundant. The modifications to analysis_options.yaml are correct and the subsequent code fixes align with the new linting rules. Overall, this is a solid stylistic improvement for the codebase.
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for go_router and go_router_builder part
|
Hm, that's unfortunate. From the |
Ah good to know! I will bump the framework too, I think it is still on 3.8 |
|
.. or 3.10. We're headed that way to adopt dot shorthands in the framework. Checking in with @loic-sharma |
I would not expect this issue to affect anything in the framework tree; it's specific to the fact that we run |
|
Ok. Touched base with Loïc, we want to publish guidelines/style guide for use of dot shorthands, so we won't bump to 3.10 until we have been able to finalize and communicate those. |
parlough
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package:mustache_template changes look good to me! Thanks :D
Piinks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Since there's a window of opportunity here where everything passed without any other PRs landing (and since unlike flutter/flutter we don't have a way to close the flutter/packages tree manually), I'm going to seize the moment and land this now rather than tomorrow. |
flutter/packages@e019cf9...cc3dca6 2025-11-24 stuartmorgan@google.com [all] Omit obvious local types (flutter/packages#10511) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Makes the analysis options changes described in flutter/flutter#178827:
After those changes, makes the following repo-wide changes:
dart fix --applyin all packages and in script/tool/dart formatin all packages and in script/tool/update-excerptsrepo tooling command to update excerpts based on the changes to their sourcesAlso updates the min Flutter/Dart SDK version to 3.35/3.9 for the following packages, to avoid
analyzefailures in theN-2legacy analysis run due to what appears to be a 3.9 change in what the Dart analyzer continues to be an obvious local type in loop iterations:Because this is causing a significant amount of format churn already, I took this opportunity to update the repository tooling to a min Dart SDK of 3.8 (the N-2 stable version, so the earliest version we need the tooling to support) to pick up the new format style, so the amount of automated formatter change is higher in script/tool/ than in the packages.
This does contain two manual changes (other than the repo tooling min version):
dynamictoObject?in a few places wheredynamiccaused analyzer warnings under the new rule set..dart_tool/when looking for unexpected localanalysis_options.yamlfiles, to fix issues running the repo tool'sanalyzecommand locally based on recent changes indartbehavior.This does not include any CHANGELOG or version updates; even though we normally version any changes to production code, mass automated changes like this aren't worth the churn of releasing. This includes changes to lib/example/main.dart and to README.md excerpts; while the style changes will be user-visible on pub.dev, it's fine for those changes to wait for the next release of each package.
Part of flutter/flutter#178827