Skip to content

custom_lint documenation is incorrect.Β #350

@bsutton

Description

@bsutton

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.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions