-
Notifications
You must be signed in to change notification settings - Fork 83
Description
So I've just gone through and re-validated my belief that the custom_lint documentation is incorrect.
Flutter Version:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel stable, 3.35.1, on Ubuntu 25.04 6.11.0-26-generic, locale en_AU.UTF-8)
[β] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[β] Chrome - develop for the web
[β] Linux toolchain - develop for Linux desktop
[β] Android Studio (version 2024.3.2)
[β] VS Code (version 1.103.0)
[β] Connected device (3 available)
[β] Network resources
β’ No issues found!
Test process:
Create a new flutter project:
flutter create test_project
add lint hard to the project.
dart pub add --dep lint_hard
Open the project in vs-code.
Edit analysis_options.yaml
include: package:lint_hard/all.yaml
linter:
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
Create a class that breaks the custom lint rule fields_first_constructors_next from the lint_hard package.
class MyClass {
int afield;
MyClass(this.afield);
}
Note: the main.dart library also breaks this rule.
Run dart pub get
Wait a moment and check the problems panel in vs-code.
The lint warning for fields_first_constructors_next appears in the problems list.
Summary:
there is no need to add custom_lint as a dev dependency and there is no need to add a plugin statement in the apps analysis_options.yaml.
I assume this is because the lint_hard package includes both of these.