Using dev dependencies
In Flutter, dev
dependencies are packages that you only need during development, and not in production. In this recipe you will see how to add and use a common Flutter linting package, unsurprisingly called lint
.
Getting ready
In this recipe, you will use the project created in the previous one: Importing packages and dependencies.
How to do it...
In this recipe you will add the lint
package to your Flutter project and configure it to use linting rules:
- Add the latest version of the
lint
package as adev
dependency in yourpubspec.yaml
, and remove any other linting packages you may find there:dev_dependencies: flutter_test: sdk: flutter lint: ^2.0.0
- In the console, run
flutter pub get
to download the package. - If required, create a new file, called
analysis_options.yaml
, in theroot
of your project. - Alternatively, open
analysis_options.yaml
, and edit its content so that it only contains...