Why is flutter analyze different from dart analyze?
I would assume they use different presets (if you have not configured analysis_options.yaml
).
The dart analyze
may default to something that is more appropriate for a published package (public_member_api_docs
) while flutter analyze
is more for an app that doesn't have an API that is being consumed.
You can try to add an analysis_options.yaml
file with some preset configuration like lint or pedantic.
With that you may see more hints and warnings but you have a good baseline and I think both commands should give you the same output.
Alternatively you can start with an empty analysis_options.yaml
and enable/disable the checks that you want to use one by one.
Edit
Why doesn't flutter analyze respect the settings from my analysis_options.yaml?
I missed this. There have traditionally been differences in the output and also in the formatting of both commands as they have been using different dependency versions. With Dart 2.12 and Flutter 2.0 they are both supposed to be using the same things under the hood.
That being said, there currently seems to be https://github.com/flutter/flutter/projects/106 in progress to fix the last remaining disparities.