Define a linter rule for flutter and dart

Viewed 875

As you know there are some pre-defined rules for linter, but I wonder how can I define a custom linter rule for flutter and dart?

2 Answers

You need to add the analyzer package to your dependencies and then make a analysis_options.yaml file in the root of your project. in there you can import other analyzer rules like effective_dart or add the ones that you need from the lint rule list.

Here is an example for analysis_options.yaml:

linter:
  rules:
    - camel_case_types
    - empty_constructor_bodies
Related