sdk
sdk copied to clipboard
Analyzer Plugins not activated when using `$name: $version` syntax as documented
I created a plugin using the analysis_server_plugin package. After publishing it on pub.dev and trying to use it from an app, I noticed this issue.
The notation described in Analyzer Plugins and Using Plugins, such as the following ($name: $version), does not activate the plugin.
plugins:
my_plugins: 2.0.0
The plugin becomes active only when adding the version keyword, as shown below:
plugins:
my_plugins:
version: 2.0.0
When using the diagnostics option, the former notation also results in a syntax error:
plugins:
my_plugins: 2.0.0
diagnostics:
avoid_hardcoded_color: false
There is no issue when using the notation with the version key:
plugins:
my_plugins:
version: 2.0.0
diagnostics:
avoid_hardcoded_color: false
I have also prepared a minimal Flutter project that reproduces the issue: https://github.com/riscait/flutter_playground
Is the documentation incorrect? If the version key is actually required, I would like to update the documentation accordingly.
I’m not certain, but I think the implementation code might be in this area of the repository: https://github.com/dart-lang/sdk/blob/e4fd90fc45a379570e965585e7f98b639264b616/pkg/analyzer/lib/src/dart/analysis/analysis_options.dart#L217