Flutter Engine
The Flutter Engine
|
This document describes the process of adding a new (non-lint) pubspec diagnostic to the analyzer.
Analyzer parses pubspecs and sends change notifications to a validator that can be used to produce diagnostics in pubspec.yaml files. Taking advantage of this we can provide rich dynamic feedback to authors as they type.
The basic recipe for implementing a new pubspec diagnostic is as follows:
PubspecWarningCode
code to messages.yaml
.generate_files
).test/src/pubspec/diagnostics
.lib/src/pubspec/validators
and add it to list of validators in pubspec_validator.dart
(or enhance an existing one).Once implemented, you’ll want to look for ecosystem breakages. Useful bots to watch:
analyzer-analysis-server-linux-try flutter-analyze-try flutter-engine-linux-try
You’ll need to clean up these downstream breakages before you can land yours.
In the case of SDK breakages, you can fix them in your initial PR. Flutter and Flutter Engine breakages should be handled in PRs to their respective Flutter repos.
The introduction of diagnostics for deprecated fields (corresponding to the existing [pub client check][]) demonstrates a lot of these ideas and serves as a good jumping off point for future diagnostics.