Skip to main content

Rules

tip

General rules configuration is described here.

Rules are grouped by category to help you understand their purpose. Each rule has emojis denoting:

  • ⚙️ - this rule is configurable
  • 🛠 - some problems reported by this rule can be fixed by editor suggestions
  • ⚠️ - this rule is deprecated and will be removed in the next major release

You can also suggest a rule!

Categories
All
Tags
All
Severities
All
Versions
All
Config
Unset
Fixes
Unset
Presets
All
Plans
All
Total Rules: 374

Common 262 rules

arguments-ordering

Ensures that the order of named arguments in function, method, and constructor invocations matches the corresponding order of named parameters

⚙️🛠
style
#consistency#pedantic
Pro+
avoid-accessing-collections-by-constant-index

Warns when a collection is accessed by a constant index inside a for loop

warning
#correctness
Pro+
preset: recommended
avoid-accessing-other-classes-private-members

Warns when a private member of another class is used

warning
#correctness#maintainability
Pro+
avoid-adjacent-strings

Warns against any usage of adjacent strings

style
#correctness#readability#maintainability
Pro+
avoid-assigning-to-static-field

Warns when an instance method assigns to a static field

warning
#correctness#maintainability
Pro+
avoid-assignments-as-conditions

Warns when an assignment is used inside a condition

warning
#correctness#readability#cwe
Pro+
preset: recommended
avoid-async-call-in-sync-function

Warns when an async function is invoked in non-async blocks

warning
#correctness#maintainability
Pro+
avoid-banned-annotations

Warns against using banned annotations (configurable)

⚙️🛠
warning
#maintainability#requires-config
Pro+
avoid-banned-file-names

Warns against using banned file names (configurable)

⚙️
warning
#architecture#maintainability#requires-config
Pro+
avoid-banned-imports

Warns against using banned imports (configurable)

⚙️🛠
warning
#architecture#maintainability#requires-config
Pro+
avoid-banned-names

Warns against using banned names (configurable)

⚙️
warning
#readability#maintainability#requires-config
Pro+
avoid-banned-types

Warns against using banned types (configurable)

⚙️
warning
#architecture#maintainability#requires-config
Pro+
avoid-barrel-files

Warns when a file is a barrel file

warning
#maintainability
Pro+
avoid-bottom-type-in-patterns

Warns when a pattern contains a void,Never or Null type

warning
#correctness
Pro+
avoid-bottom-type-in-records

Warns when a record type declaration contains fields with void, Never or Null

warning
#correctness
Pro+
avoid-cascade-after-if-null

Warns when a cascade expression is used after if null (??) binary expression without parentheses

🛠
warning
#correctness
Free+
preset: recommended
avoid-casting-to-extension-type

Warns when an expression is casted to an extension type

🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-collapsible-if

Warns when multiple nested if statements can be merged into one

🛠
style
#consistency#readability
Pro+
avoid-collection-equality-checks

Warns when a collection is checked for equality with another collection

warning
#correctness#cwe
Pro+
preset: recommended
avoid-collection-methods-with-unrelated-types

Warns when a collection method is used with an expression of an unrelated type

warning
#correctness#cwe
Pro+
preset: recommended
avoid-collection-mutating-methods

Warns when a mutating method is called on a collection

⚙️
warning
#correctness#maintainability
Pro+
avoid-complex-loop-conditions

Warns when a loop condition is too complex

warning
#readability#maintainability
Pro+
avoid-conditions-with-boolean-literals

Warns then a binary expression has a boolean constant that either makes the resulting value always the same or does not affect it

warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-contradictory-expressions

Warns when several conditions contradict each other

warning
#correctness#cwe
Pro+
preset: recommended
avoid-declaring-call-method

Warns when a class has a call method

🛠
warning
#maintainability
Pro+
avoid-double-slash-imports

Warns when an import/export directive contains a double slash

🛠
warning
#correctness
Pro+
preset: recommended
avoid-duplicate-cascades

Warns when a cascade expression has duplicate cascades

⚙️🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-duplicate-collection-elements

Warns when a collection has duplicate collection elements

⚙️
warning
#correctness#cwe
Pro+
avoid-duplicate-constant-values

Warns when a class or enum declaration has several constants with the same primitive values

warning
#correctness#cwe
Pro+
avoid-duplicate-exports

Warns when a file has multiple exports declarations with the same URI

🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-duplicate-initializers

Warns when a final variable has the same initializer as another variable in scope

warning
#correctness#cwe
Pro+
preset: recommended
avoid-duplicate-map-keys

Warns when a map has duplicate keys

🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-duplicate-mixins

Warns when a class has a mixin that is already present in that class's hierarchy.

🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-duplicate-named-imports

Warns when a file has duplicate imports which differ only in name prefix

warning
#maintainability#cwe
Free+
avoid-duplicate-patterns

Warns when a LogicalOrPattern or LogicalAndPattern contains duplicate patterns

🛠
warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-duplicate-switch-case-conditions

Warns when several switch cases have the same condition

warning
#correctness#cwe
Pro+
preset: recommended
avoid-duplicate-test-assertions

Warns when a test case has multiple test assertions with the same expression and expected value

🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-dynamic

Warns when dynamic type is used as variable type in declaration, return type of a function, etc

warning
#correctness#maintainability
Free+
preset: recommended
avoid-empty-spread

Warns when a collection literal in spread (...[]) has no elements

🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-empty-test-groups

Warns when a test group does not have any test cases

⚙️🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-equal-expressions

Warns when both sides of a binary expression are the same

🛠
warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-excessive-expressions

Warns when a condition has excessive expressions

warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-explicit-pattern-field-name

Warns when an object pattern has an explicit field name

🛠
style
#consistency#readability
Pro+
preset: recommended
avoid-explicit-type-declaration

Warns when a variable is declared with an explicit type that can be omitted

🛠
style
#consistency#readability
Pro+
avoid-extensions-on-records

Warns when an extension is declared on a record type

warning
#maintainability
Pro+
avoid-function-type-in-records

Warns when a record type declaration contains a function type

style
#consistency#maintainability
Pro+
avoid-future-tostring

Warns when a Future is a target of the toString method or is used in an interpolation

warning
#correctness#cwe
Pro+
preset: recommended
avoid-generics-shadowing

Warns when a generic type shadows an existing top-level (class, mixin, typedef or enum) declaration

warning
#correctness
Pro+
preset: recommended
avoid-getter-prefix

Warns when a getter name starts from a banned prefix (configurable)

⚙️
style
#readability#requires-config
Pro+
avoid-global-state

Warns when a global mutable variables is used

warning
#maintainability#cwe
Free+
avoid-high-cyclomatic-complexity

Warns when the cyclomatic complexity of a method or function exceeds the configured threshold

⚙️
warning
#readability#maintainability
Pro+
avoid-identical-exception-handling-blocks

Warns when a try / catch has multiple catch blocks with the same body

warning
#correctness#maintainability
Pro+
avoid-ignoring-return-values

Warns when a return value of a method or function invocation or a class instance property access is not used

warning
#correctness#maintainability
Pro+
avoid-implicitly-nullable-extension-types

Warns when an extension type declaration does not have the implements clause

🛠
warning
#correctness#maintainability
Pro+
preset: recommended
avoid-importing-entrypoint-exports

Warns when an entrypoint export is imported inside the library src folder

⚙️🛠
style
#maintainability
Pro+
avoid-incorrect-uri

Warns when the Uri constructor receives incorrect arguments

warning
#correctness
Pro+
avoid-inferrable-type-arguments

Warns when an inferrable type argument can be removed without affecting the code

⚙️🛠
style
#consistency#readability
Pro+
preset: recommended
avoid-inverted-boolean-checks

Warns when a condition has an inverted check

style
#readability#maintainability
Pro+
avoid-keywords-in-wildcard-pattern

Warns when a wildcard pattern has declaration keywords

🛠
style
#readability
Pro+
preset: recommended
avoid-late-final-reassignment

Warns when a late final variable is assigned multiple times in the same block

warning
#correctness
Pro+
avoid-late-keyword

Warns when a field or variable is declared with a late keyword

⚙️🛠
warning
#maintainability
Free+
avoid-local-functions

Warns when a function declaration is a local function

style
#readability
Pro+
avoid-long-functions

Warns when a function or method length (number of lines) exceeds the configured maximum

⚙️
warning
#readability#maintainability#cwe
Pro+
avoid-long-files

Warns when a file length (number of lines) exceeds the configured maximum

⚙️
warning
#readability#maintainability
Pro+
avoid-long-parameter-list

Warns then a parameter list has too many parameters

⚙️
warning
#readability#maintainability
Pro+
avoid-long-records

Warns when a record has too many fields

⚙️
warning
#readability#maintainability
Pro+
avoid-map-keys-contains

Warns when Map's .keys.contains is used instead of containsKey

🛠
warning
#performance
Pro+
preset: recommended
avoid-missed-calls

Warns when a method that should be invoked is passed as tear-off

🛠
warning
#correctness
Pro+
preset: recommended
avoid-missing-completer-stack-trace

Warns when Completer.completeError is called without providing a stack trace

warning
#correctness
Pro+
preset: recommended
avoid-missing-enum-constant-in-map

Warns when a enum constant is missing in a map declaration

warning
#correctness
Pro+
preset: recommended
avoid-missing-interpolation

Warns when a string equals to a variable name that is available in the current scope but is not wrapped into an interpolation

warning
#correctness
Pro+
avoid-missing-test-files

Configure a list of files that should have a corresponding test file

⚙️
warning
#architecture#maintainability#requires-config
Pro+
avoid-misused-test-matchers

Warns when an incorrect matcher or literal is used to verify the target expression

warning
#correctness
Pro+
preset: recommended
avoid-misused-set-literals

Warns when a set literal is used in a wrong place

warning
#correctness
Pro+
preset: recommended
avoid-misused-wildcard-pattern

Warns when a wildcard pattern is used in the wrong context

warning
#correctness#cwe
Pro+
avoid-mixing-named-and-positional-fields

Warns when a record declaration contains both named and positional fields

style
#consistency#readability
Pro+
avoid-multi-assignment

Warns when multiple variable assignments are placed on the same line

warning
#correctness#maintainability#cwe
Pro+
preset: recommended
avoid-mutating-parameters

Warns when a parameter's field or setter is reassigned.

warning
#maintainability
Pro+
avoid-negated-conditions

Warns when an if statement or conditional expression have a negated condition that can be inverted

⚙️🛠
style
#readability#maintainability
Pro+
avoid-negations-in-equality-checks

Warns when an equality check has a negated expression

🛠
warning
#correctness#readability#maintainability
Pro+
avoid-nested-conditional-expressions

Suggests to refactor conditional expressions when the nesting level exceeds the configured threshold

style
#readability
Pro+
avoid-nested-extension-types

Warns when the representation field of an extension type is also an extension type

⚙️
style
#readability
Pro+
avoid-nested-futures

Warns when a Future type contains another Future

warning
#correctness
Pro+
preset: recommended
avoid-nested-records

Warns when a record type declaration contains a nested record type declaration

⚙️
style
#readability
Pro+
preset: recommended
avoid-nested-streams-and-futures

Warns when a Stream type contains a Future or vice versa

warning
#correctness
Pro+
avoid-nested-switch-expressions

Warns when a switch expression contains another switch expression

⚙️
style
#readability
Pro+
avoid-nested-switches

Warns when a switch case body has another switch statement

style
#readability
Pro+
avoid-non-ascii-symbols

Warns when a string literal contains non ascii characters

⚙️
warning
#correctness
Pro+
avoid-non-empty-constructor-bodies

Suggests moving all initialization logic to a separate method instead of the constructor

warning
#maintainability
Pro+
avoid-non-final-exception-class-fields

Warns when an exception class declaration has non-final fields

🛠
warning
#correctness#maintainability
Pro+
avoid-non-null-assertion

Warns when the non-null assertion operator ! (or “bang” operator) is used on a property access or method invocation

⚙️
warning
#correctness#cwe
Free+
avoid-not-encodable-in-to-json

Warns when a toJson method references a non-encodable object

⚙️
warning
#correctness#cwe
Pro+
preset: recommended
avoid-nullable-interpolation

Warns when an interpolation string contains a nullable value

⚙️
warning
#correctness
Pro+
preset: recommended
avoid-nullable-parameters-with-default-values

Warns when a parameter with the default value is marked as nullable

🛠
warning
#correctness#maintainability
Pro+
preset: recommended
avoid-nullable-tostring

Warns when the toString method is called on a nullable value

🛠
warning
#correctness#cwe
Pro+
preset: recommended
avoid-one-field-records

Warns when a record has only one field

warning
#correctness
Pro+
avoid-only-rethrow

Warns when a catch clause has only a rethrow expression

warning
#correctness#cwe
Pro+
preset: recommended
avoid-passing-async-when-sync-expected

Warns when an asynchronous function is used as an argument where a synchronous function is expected

warning
#correctness#maintainability#cwe
Pro+
preset: recommended
avoid-passing-default-values

Warns when an invocation has an argument that matches the parameter's default value.

⚙️🛠
warning
#readability#maintainability
Pro+
avoid-passing-self-as-argument

Warns when an object is used as an argument to its own method

warning
#correctness#cwe
Pro+
preset: recommended
avoid-positional-record-field-access

Warns when a record positional field is accessed via $

warning
#readability#maintainability
Pro+
avoid-recursive-calls

Warns when a function calls itself recursively

warning
#correctness#maintainability
Pro+
avoid-redundant-async

Checks for redundant async in a method or function body

🛠
warning
#correctness#maintainability
Pro+
preset: recommended
avoid-redundant-else

Checks for else blocks that can be removed without changing semantics

🛠
style
#readability
Pro+
preset: recommended
avoid-redundant-positional-field-name

Warns when a record positional field has a name

🛠
warning
#correctness
Pro+
preset: recommended
avoid-redundant-pragma-inline

Warns when a @pragma('vm:prefer-inline') annotation has no effect

🛠
warning
#correctness
Pro+
preset: recommended
avoid-referencing-discarded-variables

Warns when a variable with the name that has only underscores (ex. _, __, etc.) is referenced

⚠️
warning
#correctness#maintainability
Pro+
preset: recommended
avoid-referencing-subclasses

Warns when a parent class references its child class

⚙️
warning
#correctness#maintainability#cwe
Pro+
avoid-renaming-representation-getters

Warns when an extension type exposes a member that renames an existing representation field member

🛠
warning
#correctness
Pro+
preset: recommended
avoid-returning-cascades

Warns when a cascade expression is being returned from a function

style
#correctness#maintainability
Pro+
avoid-returning-void

Suggests calling functions or methods with a void return type separately from the return statement

🛠
style
#readability#maintainability
Pro+
avoid-self-assignment

Warns when a variable or a class instance field / property is assigned to itself

🛠
warning
#correctness
Pro+
preset: recommended
avoid-self-compare

Warns when a comparison has both sides exactly the same

warning
#correctness#cwe
Free+
preset: recommended
avoid-shadowed-extension-methods

Warns when an extension declares a method with the name that is already used by the extension target

warning
#correctness
Pro+
preset: recommended
avoid-shadowing

Warns when a declaration name shadows another declaration with the same name in the current scope

⚙️
warning
#correctness
Pro+
preset: recommended
avoid-similar-names

Checks for names within the scope that are very similar and thus confusing

⚙️
style
#readability#maintainability
Pro+
avoid-slow-collection-methods

Warns when an invocation is a slow sync* invocation

warning
#performance
Pro+
avoid-substring

Warns when a String.substring method is used

warning
#correctness
Free+
avoid-suspicious-super-overrides

Warns when a getter overrides a field that is already passed to the super constructor

🛠
warning
#correctness
Pro+
preset: recommended
avoid-throw-in-catch-block

Warns when a throw expression is called inside a catch block

warning
#correctness
Free+
preset: recommended
avoid-throw-objects-without-tostring

Warns when a thrown object does not implement toString

warning
#correctness#cwe
Pro+
preset: recommended
avoid-top-level-members-in-tests

Warns when a public top-level member (except the entrypoint) is declared inside a test file

🛠
warning
#maintainability
Free+
avoid-type-casts

Warns about any usages of the as operator

warning
#correctness#maintainability#cwe
Pro+
avoid-unassigned-late-fields

Warns when a late field is not assigned a value

warning
#correctness#cwe
Pro+
preset: recommended
avoid-unassigned-stream-subscriptions

Warns when a stream subscription is not assigned to a variable

warning
#memory-leak#cwe
Pro+
preset: recommended
avoid-uncaught-future-errors

Warns when an error from a Future inside a try / catch block might not be caught

warning
#correctness
Pro+
preset: recommended
avoid-unconditional-break

Warns when a break, continue, return or throw are used unconditionally in a for loop

warning
#correctness#cwe
Pro+
preset: recommended
avoid-unknown-pragma

Warns when the @pragma annotation has an unknown value

warning
#correctness
Pro+
preset: recommended
avoid-unnecessary-call

Warns when a .call() invocation is unnecessary and can be simplified

🛠
style
#readability
Pro+
preset: recommended
avoid-unnecessary-collections

Warns when a collection literal can be replaced by its first and only element

warning
#correctness
Pro+
preset: recommended
avoid-unnecessary-conditionals

Checks for unnecessary conditional expressions

🛠
warning
#consistency#readability
Pro+
preset: recommended
avoid-unnecessary-constructor

Suggests removing an unnecessary empty constructor for enum and class declarations

🛠
style
#consistency#readability
Pro+
avoid-unnecessary-enum-arguments

Warns when a enum constant has an unnecessary empty argument list

🛠
style
#consistency#readability
Pro+
preset: recommended
avoid-unnecessary-enum-prefix

Suggests removing unnecessary enum prefixes

🛠
style
#consistency#readability
Pro+
avoid-unnecessary-extends

Suggests removing unnecessary extends clauses that match default values for classes and type parameters

🛠
style
#consistency
Pro+
preset: recommended
avoid-unnecessary-futures

Warns when a return type of a declaration is unnecessary wrapped into a Future

🛠
warning
#maintainability
Pro+
preset: recommended
avoid-unnecessary-getter

Warns when a getter provides access to an existing final field without any additional logic

style
#consistency
Pro+
avoid-unnecessary-if

Warns when a return statement inside an if block is equal to the return statement after it

🛠
warning
#correctness
Pro+
preset: recommended
avoid-unnecessary-local-late

Warns when a late variable is assigned in all code branches before use

🛠
warning
#maintainability
Pro+
preset: recommended
avoid-unnecessary-negations

Warns when a negation can be simplified

🛠
warning
#readability#maintainability
Pro+
preset: recommended
avoid-unnecessary-nullable-return-type

Warns when the return type of a function or a method is declared nullable, but the function or method always return non-nullable value

🛠
warning
#correctness#maintainability
Pro+
preset: recommended
avoid-unnecessary-overrides

Warns when a parent declaration is overridden by a declaration without an implementation

🛠
warning
#correctness#maintainability
Pro+
preset: recommended
avoid-unnecessary-reassignment

Warns when a value is reassigned to a variable without using the initial value

warning
#correctness#maintainability#cwe
Pro+
preset: recommended
avoid-unnecessary-return

Warns when a return statement is unnecessary and can be removed

🛠
style
#readability
Pro+
preset: recommended
avoid-unnecessary-super

Warns when a constructor has an unnecessary super invocation or when an invocation has an unnecessary super prefix

🛠
style
#consistency
Pro+
preset: recommended
avoid-unnecessary-type-assertions

Warns about unnecessary usage of the is operator, and whereType and whereNotNull methods

warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-unnecessary-type-casts

Warns about unnecessary use of the as operator and cast method

warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-unrelated-type-assertions

Warns about unrelated usages of the is operator and whereType method

⚙️
warning
#correctness#cwe
Pro+
preset: recommended
avoid-unrelated-type-casts

Warns about unrelated usages of the as operator and cast method

warning
#correctness#cwe
Pro+
preset: recommended
avoid-unsafe-collection-methods

Warns when first, last, single, firstWhere, lastWhere, singleWhere or [] methods are used on Iterable or its subclasses

🛠
warning
#correctness#maintainability#cwe
Pro+
preset: recommended
avoid-unsafe-reduce

Warns when the .reduce collection method is called on a potentially empty collection

warning
#correctness#maintainability#cwe
Pro+
avoid-unused-after-null-check

Warns when a variable is checked for non-nullable value, but is not used within the condition or then branch

warning
#correctness
Pro+
avoid-unused-assignment

Warns when an assignment is not used in the subsequent statements

warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-unused-generics

Warns when a function or method declares unused generic types

⚙️🛠
warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-unused-instances

Warns when a newly created object is not being used

⚙️
warning
#correctness
Pro+
preset: recommended
avoid-unused-parameters

Checks for unused parameters inside a function or method body

⚙️🛠
warning
#correctness#unused-code#cwe
Pro+
preset: recommended
avoid-weak-cryptographic-algorithms

Warns when a weak cryptographic algorithm (ex. md5 or sha1) is used

warning
#security#cwe
Pro+
avoid-wildcard-cases-with-enums

Warns when a switch on the Enum value has a wildcard pattern case

warning
#correctness#maintainability
Pro+
preset: recommended
banned-usage

Warns when the configured method, field, constructor, or property name is used

⚙️
warning
#architecture#consistency#maintainability#requires-config
Pro+
binary-expression-operand-order

Warns when a literal value is on the left hand side in a binary expressions

🛠
style
#consistency#readability
Free+
dispose-class-fields

Warns when a field is not disposed in a class's dispose method

⚙️
warning
#correctness#memory-leak
Pro+
preset: recommended
double-literal-format

Checks that double literals should begin with 0. instead of just ., and should not end with a trailing 0

⚙️🛠
style
#consistency#readability
Free+
enum-constants-ordering

Ensures consistent alphabetical order of Enum constants

🛠
style
#consistency
Pro+
format-comment

Suggests to format comments like sentences

⚙️🛠
style
#consistency#readability
Pro+
format-test-name

Warns when a test or testWidgets name doesn't follow the configured pattern

⚙️
style
#consistency#readability#requires-config
Pro+
function-always-returns-null

Warns when a function with nullable return type returns only nullvalue

⚙️
warning
#correctness#cwe
Pro+
preset: recommended
function-always-returns-same-value

Warns when a function always returns the same constant value

warning
#correctness#cwe
Pro+
handle-throwing-invocations

Warns when an invocation's declaration is annotated with @Throws() but the potential exception is not handled

warning
#correctness#maintainability#cwe
Pro+
map-keys-ordering

Ensures consistent alphabetical order of String keys inside a map

style
#consistency#readability#pedantic
Pro+
match-class-name-pattern

Warns when a class name does not match the configured pattern

⚙️
style
#consistency#readability#requires-config
Pro+
match-getter-setter-field-names

Warns when a getter or setter do not access at least one field with the name that matches the getter or setter name

warning
#correctness#readability#maintainability
Pro+
preset: recommended
match-lib-folder-structure

Warns when the file path in the test folder does not match the implementation file path in the lib folder

warning
#consistency#maintainability
Pro+
match-positional-field-names-on-assignment

Warns when a positional field name does not match a variable name on destructuring assignment

🛠
warning
#correctness#consistency
Pro+
member-ordering

Enforces ordering for a class members

⚙️🛠
style
#consistency#pedantic
Free+
missing-test-assertion

Warns that there is no assertion in the test

⚙️
warning
#correctness
Pro+
missing-use-result-annotation

Warns when a method or function declaration is missing the @useResult annotation

⚙️🛠
warning
#correctness#maintainability#requires-config
Pro+
move-records-to-typedefs

Warns when a record type should be moved to a typedef

⚙️🛠
warning
#consistency#readability
Pro+
move-variable-closer-to-its-usage

Warns when a variable is declared in the outer block, but used only in the inner one

⚙️
warning
#readability#maintainability
Pro+
preset: recommended
move-variable-outside-iteration

Warns when a variable does not depend on the outer loop and can be moved out

🛠
warning
#correctness#readability#maintainability
Pro+
newline-before-case

Enforces a blank line between cases in a switch statement

🛠
style
#readability#consistency
Pro+
newline-before-method

Enforces a blank line before a method declaration

🛠
style
#readability#consistency
Pro+
newline-before-return

Enforces a blank line between statements and return in a block

🛠
style
#readability#consistency
Free+
no-boolean-literal-compare

Warns on comparison to a boolean literal, as in x == true

⚙️🛠
style
#readability
Free+
no-empty-block

Disallows empty blocks except catch clause block

warning
#correctness#cwe
Free+
preset: recommended
no-equal-arguments

Warns when equal arguments are passed to a function or method invocation

⚙️
warning
#correctness#maintainability#cwe
Pro+
no-equal-conditions

Warns when a if statement has duplicate conditions

warning
#correctness#unused-code#cwe
Pro+
preset: recommended
no-equal-nested-conditions

Warns when an if statement contains another if statement with the same condition

warning
#correctness#cwe
Pro+
preset: recommended
no-equal-switch-case

Warns when a switch has cases with equal bodies

warning
#correctness#maintainability#cwe
Pro+
preset: recommended
no-equal-switch-expression-cases

Warns when a switch expression has cases with equal bodies

warning
#correctness#maintainability#cwe
Pro+
preset: recommended
no-equal-then-else

Warns when if statement has equal then and else statements or conditional expression has equal then and else expressions

🛠
warning
#correctness#cwe
Free+
preset: recommended
no-magic-number

Warns when number literals are used outside of named constants or variables

⚙️
warning
#readability#maintainability
Free+
no-magic-string

Warns when string literals are used outside of named constants or variables

⚙️
warning
#readability#maintainability
Pro+
no-object-declaration

Warns when a class member is declared with Object type

style
#maintainability
Pro+
parameters-ordering

Ensures consistent alphabetical order of parameters by their names

⚙️🛠
style
#consistency#readability#pedantic
Pro+
prefer-abstract-final-static-class

Suggests adding abstract final to classes with only static members to avoid them being instantiated or being used in inheritance

🛠
style
#readability#maintainability
Pro+
prefer-add-all

Suggests using .addAll() instead of multiple .add() invocations

style
#readability#consistency
Pro+
prefer-addition-subtraction-assignments

Warns when ++ or -- is used instead of += or -=

🛠
warning
#correctness
Pro+
prefer-any-or-every

Warns when a collection's call chain can be rewritten to use .any() or .every() instead of .isEmpty or .isNotEmpty

🛠
warning
#readability
Pro+
preset: recommended
prefer-async-await

Recommends to use async/await syntax to handle a Future result instead of .then() invocation

style
#readability#maintainability
Pro+
prefer-boolean-prefixes

Suggests to prefix boolean variables, methods, fields and parameters with one of the configured prefixes

⚙️
style
#readability
Pro+
prefer-both-inlining-annotations

Warns when a @pragma('vm:prefer-inline') annotation does not have a corresponding @pragma('dart2js:tryInline') annotation

🛠
warning
#correctness
Pro+
prefer-bytes-builder

Warns when an expensive byte list operation is used

warning
#performance
Pro+
prefer-commenting-analyzer-ignores

Warns when // ignore: comments are left without any additional description of why this ignore is applied

⚙️
warning
#maintainability
Pro+
prefer-conditional-expressions

Recommends to use a conditional expression instead of assigning to the same thing or return statement in each branch of an if statement

⚙️🛠
style
#readability
Free+
prefer-contains

Suggests using .contains instead of .indexOf when checking for the presence of an element

🛠
style
#readability
Pro+
preset: recommended
prefer-correct-callback-field-name

Warns when a field with a Function type does not matched the configured name or a field with a non-Function type matches the configured name

⚙️
style
#consistency#readability
Pro+
preset: recommended
prefer-correct-error-name

Ensures a consistent name for the error parameter in catch, then, catchError, listen and handleError

⚙️🛠
style
#consistency#readability
Pro+
prefer-correct-for-loop-increment

Warns when a for loop increments a wrong variable

warning
#correctness#cwe
Pro+
preset: recommended
prefer-correct-future-return-type

Warns when a declaration that returns a Future has an incorrect return type

🛠
warning
#maintainability
Pro+
prefer-correct-handler-name

Warns when the callback handler name does not matched the configured one

⚙️
style
#consistency
Pro+
prefer-correct-identifier-length

Warns when the identifier name in variables, parameters, or enum constants is too short or too long

⚙️
style
#consistency#readability
Pro+
prefer-correct-json-casts

Warns when a JSON object type cast is done in an unsafe way that will throw at runtime

warning
#correctness#maintainability#cwe
Pro+
preset: recommended
prefer-correct-setter-parameter-name

Warns when the setter parameter name does not match the configured one

⚙️🛠
style
#consistency
Pro+
prefer-correct-stream-return-type

Warns when a declaration that returns a Stream has an incorrect return type

🛠
warning
#maintainability
Pro+
prefer-correct-switch-length

Warns when a switch has too few or too many cases

⚙️
style
#readability#maintainability
Pro+
prefer-correct-test-file-name

Warns if the file within /test contains a main, but the file name doesn't end with _test.dart

warning
#correctness
Pro+
preset: recommended
prefer-correct-throws

Warns when a declaration is missing or has an unnecessary @Throws() annotation

🛠
warning
#correctness#maintainability
Pro+
prefer-correct-type-name

Warns when a type name contains unexpected characters, does not start with an uppercase character, or is too short or too long

⚙️
style
#consistency#readability
Pro+
prefer-declaring-const-constructor

Warns when a class with no non-final fields has a non-constant constructor declaration

⚙️🛠
warning
#consistency#performance
Pro+
preset: recommended
prefer-early-return

Warns when an if statement can be transformed to an early return

⚙️
style
#readability
Pro+
prefer-enums-by-name

Since Dart 2.15 it's possible to use byName method on enum values prop instead of searching the value with firstWhere

style
#readability
Free+
prefer-explicit-function-type

Warns when a Function type does not specify the return type and arguments

warning
#correctness#consistency#maintainability
Pro+
preset: recommended
prefer-explicit-parameter-names

Warns when parameter names in function types are omitted

style
#consistency#readability
Pro+
prefer-explicit-type-arguments

Warns when a method that accepts type arguments has no arguments and no type arguments passed

🛠
warning
#correctness#maintainability
Pro+
prefer-extracting-function-callbacks

Warns when an inline callback is passed as an argument to a function or method invocation

⚙️
style
#readability#maintainability
Pro+
prefer-first

Use first to gets the first element

🛠
style
#readability
Free+
prefer-for-in

Suggests using for-in loop instead of the regular loop

style
#readability#consistency
Pro+
prefer-getter-over-method

Suggests to convert a method that has no parameters and side-effects to a getter

⚙️
style
#readability
Pro+
prefer-immediate-return

Warns when a method or a function returns a variable declared right before the return statement

🛠
style
#readability
Free+
prefer-iterable-of

Warns when List.from() factory is used instead of List.of()

🛠
warning
#correctness#cwe
Free+
preset: recommended
prefer-last

Use last to gets the last element

🛠
style
#readability
Free+
prefer-match-file-name

Warns when a file name does not match the class name

🛠
warning
#consistency#readability#maintainability
Free+
preset: recommended
prefer-moving-to-variable

Warns when a property access or a method invocation start with duplicated chains of other invocations / accesses inside a single function or method block

⚙️
warning
#maintainability
Pro+
prefer-named-boolean-parameters

Warns when a declaration has a boolean positional parameter

⚙️
style
#readability#maintainability
Pro+
prefer-named-imports

Warns if the configured import is not a named import

⚙️
warning
#consistency#readability#maintainability#requires-config
Pro+
prefer-named-parameters

Suggests converting positional parameters to named parameters when a declaration has a certain number of positional parameters

⚙️
style
#readability#maintainability
Pro+
prefer-null-aware-spread

Warns when a null check inside a collection literal can be replaced with a null-aware spread (...?)

style
#readability
Pro+
preset: recommended
prefer-overriding-parent-equality

Warns when a parent class implements hashCode and ==, but the child class does not implement them

warning
#correctness
Pro+
preset: recommended
prefer-parentheses-with-if-null

Warns when an if null (??) has a binary expression without parentheses

🛠
warning
#correctness
Pro+
preset: recommended
prefer-prefixed-global-constants

Warns when a global constant does not start with a configured prefix

⚙️
style
#consistency#readability
Pro+
preset: recommended
prefer-private-extension-type-field

Warns when an extension type has a public representation field

🛠
warning
#maintainability
Pro+
preset: recommended
prefer-public-exception-classes

Warns when an exception class declaration is not public

🛠
warning
#correctness#maintainability
Pro+
preset: recommended
prefer-return-await

Warns when a Future is returned from a try / catch block without an await

🛠
warning
#correctness#cwe
Pro+
preset: recommended
prefer-returning-conditional-expressions

Warns when several returns inside a function body can be replace with a single conditional expression

🛠
style
#readability
Pro+
prefer-simpler-boolean-expressions

Suggests simplifying various boolean expressions

style
#readability#maintainability
Pro+
prefer-simpler-patterns-null-check

Warns when a patterns check for non-nullability can be simplified

🛠
style
#readability#maintainability
Pro+
preset: recommended
prefer-single-declaration-per-file

Warns when a file contains more than one top-level declaration (class, mixin, extension, enum or extension type)

⚙️
style
#readability#maintainability
Pro+
prefer-specific-cases-first

Warns when a more specific switch case is placed after a more general one

🛠
warning
#correctness#cwe
Pro+
preset: recommended
prefer-static-class

Suggests to use static class member instead of global constants, variables and functions

⚙️
style
#consistency
Pro+
prefer-switch-with-enums

Suggests to use a switch statement or expression instead of conditionals with multiple enum values

⚙️
style
#readability#maintainability
Pro+
preset: recommended
prefer-switch-with-sealed-classes

Suggests to use a switch statement or expression instead of conditionals with sealed class instances

style
#readability#maintainability
Pro+
prefer-test-matchers

Warns when the second argument of an expect or expectLater is not a subclass of a Matcher

warning
#consistency#maintainability
Pro+
prefer-trailing-comma

Checks for a trailing comma for arguments, parameters, enum values and collections

⚙️🛠
style
#consistency#readability
Pro+
preset: recommended
prefer-type-over-var

Warns when a variable is declared with the var keyword instead of a type

🛠
style
#readability#maintainability
Pro+
prefer-typedefs-for-callbacks

Warns when a Function type is declared not as a typedef

⚙️
style
#readability#maintainability
Pro+
prefer-unique-test-names

Warns when the test name is not unique within the same test suite

⚙️
warning
#correctness
Pro+
preset: recommended
prefer-unwrapping-future-or

Warns when a FutureOr is not unwrapped before being used

warning
#maintainability
Pro+
prefer-visible-for-testing-on-members

Warns when the @visibleForTesting annotation is applied to the class declaration

🛠
warning
#correctness
Pro+
prefer-wildcard-pattern

Warns when a dynamic or Object type is used instead of a wildcard pattern

🛠
warning
#consistency#readability
Pro+
preset: recommended
tag-name

Warns when a tag name does not match the class name

⚙️🛠
warning
#correctness#requires-config
Pro+
unnecessary-trailing-comma

Checks for unnecessary trailing commas for arguments, parameters, enum values and collections

⚙️🛠
style
#consistency#readability
Pro+
preset: recommended
use-existing-variable

Warns when an expression can be replaced by an existing variable with the same initializer

🛠
warning
#consistency#maintainability
Pro+

Flutter 44 rules

add-copy-with

Warns when a class that matches the config does not declare a copyWith method

⚙️
warning
#correctness#maintainability#requires-config
Pro+
always-remove-listener

Warns when an event listener is added but never removed

warning
#correctness#memory-leak
Free+
preset: recommended
avoid-border-all

Suggests replacing the Border.all constructor with the const Border.fromBorderSide constructor

🛠
warning
#readability#performance
Free+
avoid-empty-setstate

Warns when a setState callback is empty

warning
#correctness#cwe
Pro+
preset: recommended
avoid-expanded-as-spacer

Suggests using the Spacer widget instead of the Expanded widget containing empty SizedBox/Container widget

🛠
style
#consistency#readability
Free+
avoid-flexible-outside-flex

Warns when a Flexible widget is used outside the Flex widget

warning
#correctness
Pro+
avoid-incomplete-copy-with

Checks if all parameters from the default constructor are added to the copyWith method

warning
#correctness#maintainability
Pro+
preset: recommended
avoid-incorrect-image-opacity

Warns when an Image widget is wrapped into an Opacity widget

🛠
warning
#performance
Pro+
preset: recommended
avoid-inherited-widget-in-initstate

Warns when context.dependOnInheritedWidgetOfExactType is transitively called from any invocation in initState

warning
#correctness
Pro+
avoid-late-context

Warns when the context is used inside a late field initializer

warning
#correctness
Pro+
avoid-missing-controller

Warns when a TextFormField, TextField or EditableText does not have at least one way to get the updated value

warning
#correctness
Pro+
preset: recommended
avoid-missing-image-alt

Warns when an Image widget does not have a semanticLabel

⚙️🛠
warning
#accessibility
Pro+
preset: recommended
avoid-recursive-widget-calls

Warns when a Widget recursively uses itself

warning
#correctness
Pro+
preset: recommended
avoid-returning-widgets

Warns when a method or function returns a Widget or subclass of a Widget

⚙️
warning
#correctness#maintainability#performance
Free+
avoid-shrink-wrap-in-lists

Warns when a ListView widget with shrinkWrap parameter is wrapped in a Column, Row or another ListView widget

warning
#correctness
Free+
avoid-single-child-column-or-row

Warns when a Column, Row, Flex, Wrap, SliverList, SliverMainAxisGroup or SliverCrossAxisGroup widget has only one child

warning
#correctness#maintainability
Pro+
avoid-state-constructors

Warns when a State has a constructor with non-empty body

warning
#correctness
Pro+
preset: recommended
avoid-undisposed-instances

Warns when an instance that has a dispose method is not assigned to a variable

⚙️
warning
#correctness#memory-leak
Pro+
preset: recommended
avoid-unnecessary-gesture-detector

Warns when a GestureDetector widget has no event handlers

warning
#correctness#maintainability#unused-code
Pro+
preset: recommended
avoid-stateless-widget-initialized-fields

Warns when a StatelessWidget has an initialized final field

warning
#correctness
Pro+
avoid-unnecessary-overrides-in-state

Warns when a widget's State has unnecessary overrides

🛠
warning
#correctness#maintainability
Pro+
preset: recommended
avoid-unnecessary-setstate

Warns when setState is called inside initState, didUpdateWidget or build methods and when it is called from a sync method that is called inside those methods

warning
#correctness#performance
Pro+
preset: recommended
avoid-unnecessary-stateful-widgets

Warns when a StatefulWidget can be converted to a StatelessWidget

warning
#readability#maintainability
Pro+
preset: recommended
avoid-wrapping-in-padding

Warns when a widget is wrapped in a Padding widget but has a padding setting by itself

warning
#correctness
Free+
check-for-equals-in-render-object-setters

Warns when a RenderObject setter doesn't have an equality check for the new value

warning
#correctness
Free+
preset: recommended
consistent-update-render-object

Warns when an updateRenderObject method is absent or doesn't update all fields set in createRenderObject

warning
#correctness
Pro+
preset: recommended
dispose-fields

Warns when a widget state field is not disposed in dispose method

⚙️
warning
#correctness#memory-leak
Pro+
preset: recommended
prefer-action-button-tooltip

Warns when a FloatingActionButton does not have a tooltip specified

🛠
warning
#correctness
Pro+
prefer-center-over-align

Suggests using a Center widget instead of the Align widget with no passed arguments

🛠
warning
#readability#consistency
Pro+
prefer-const-border-radius

Suggests replacing the BorderRadius.circular constructor with the const BorderRadius.all constructor

🛠
warning
#performance
Free+
prefer-correct-edge-insets-constructor

Suggests using the correct EdgeInsets constructor

🛠
style
#consistency#readability
Free+
prefer-dedicated-media-query-methods

Warns when MediaQuery.of or MediaQuery.maybeOf are used over dedicated methods (ex. sizeOf)

🛠
warning
#correctness#performance
Pro+
preset: recommended
prefer-define-hero-tag

Warns when a Widget has an unset heroTag

🛠
warning
#correctness
Pro+
prefer-extracting-callbacks

Warns about inline callbacks in a widget tree and suggest to extract them to a widget method

⚙️
style
#readability#maintainability
Pro+
prefer-for-loop-in-children

Suggests using for-loop in arguments that accept a list of widgets

style
#readability#maintainability
Pro+
prefer-padding-over-container

Suggests using a Padding widget instead of the Container widget with only padding or margin arguments

🛠
style
#readability#consistency
Pro+
prefer-single-widget-per-file

Warns when a file contains more than one widget

⚙️
style
#readability#maintainability
Pro+
preset: recommended
prefer-sized-box-square

Suggests using the SizedBox.square constructor when height and width arguments have the same value

style
#readability
Pro+
prefer-sliver-prefix

Warns when a widget that returns a Sliver... widget does not have a Sliver prefix in its name

style
#readability#maintainability
Pro+
prefer-text-rich

Warns when a RichText widget is used instead of Text.rich

🛠
warning
#accessibility
Free+
prefer-using-list-view

Warns when a Column widget with only children parameter is wrapped in a SingleChildScrollView widget

warning
#correctness
Pro+
prefer-widget-private-members

Warns when a widget or widget state have public members (fields, methods, etc.)

🛠
style
#maintainability
Pro+
proper-super-calls

Checks that super calls in the initState and dispose methods are called in the correct order

🛠
warning
#correctness
Pro+
preset: recommended
use-setstate-synchronously

Warns when setState is called past an await point

⚙️
warning
#correctness
Pro+
preset: recommended

Provider 6 rules

note
Lint rules for the Provider package.
avoid-instantiating-in-value-provider

Warns when a Provider.value returns a new instance instead of reusing an existing one

warning
#correctness
Pro+
avoid-read-inside-build

Warns when a read method is used inside the build method

🛠
warning
#correctness
Pro+
avoid-watch-outside-build

Warns when a watch or select methods are used outside of the build method

🛠
warning
#correctness
Pro+
dispose-providers

Warns when a provided class with a dispose method does not have this method called in the Provider dispose callback

warning
#correctness#memory-leak
Pro+
prefer-multi-provider

Warns when multiple nested Providers can be replaced with MultiProvider instead

warning
#readability#maintainability
Pro+
prefer-provider-extensions

Suggests using context.read() or context.watch() instead of Provider.of(context)

style
#readability#maintainability
Pro+

Bloc 13 rules

note
Lint rules for the Bloc package.
avoid-bloc-public-methods

Warns when a Bloc has public methods except the overridden ones

🛠
warning
#correctness
Pro+
avoid-cubits

Warns when a Cubit is used

warning
#maintainability
Pro+
avoid-duplicate-bloc-event-handlers

Warns when a bloc declares multiple event handlers for the same event

warning
#correctness#maintainability
Pro+
avoid-empty-build-when

Warns when a BlocBuilder or BlocConsumer does not specify the buildWhen condition

warning
#performance#maintainability
Pro+
avoid-passing-bloc-to-bloc

Warns when a Bloc depends on another Bloc

warning
#correctness#maintainability
Pro+
avoid-passing-build-context-to-blocs

Warns when a Bloc event or a Cubit method accept BuildContext

warning
#correctness#maintainability
Pro+
check-is-not-closed-after-async-gap

Warns when an async handler does not have isClosed check before dispatching an event after an async gap

warning
#correctness#maintainability
Pro+
handle-bloc-event-subclasses

Warns when a bloc does not handle all event subclasses

warning
#correctness
Pro+
prefer-bloc-extensions

Suggests using context.read() or context.watch() instead of BlocProvider.of(context)

style
#readability#maintainability
Pro+
prefer-correct-bloc-provider

Warns when a Bloc is provided not with a BlocProvider

🛠
warning
#correctness
Pro+
prefer-multi-bloc-provider

Warns when a BlocProvider / BlocListener / RepositoryProvider can be replace with a Multi version

warning
#readability#maintainability
Pro+
prefer-sealed-bloc-events

Warns when Bloc events do not have a sealed or final modifier

⚙️
warning
#readability#maintainability
Pro+
prefer-sealed-bloc-state

Warns when Bloc state classes do not have a sealed or final modifier

⚙️
warning
#readability#maintainability
Pro+

Riverpod 7 rules

note
Lint rules for the Riverpod package.
avoid-calling-notifier-members-inside-build

Warns when a Notifier (or AsyncNotifier) member is called inside the build method

warning
#correctness
Pro+
avoid-notifier-constructors

Warns when a Notifier (or AsyncNotifier) has a non-empty constructor

warning
#correctness
Pro+
avoid-ref-read-inside-build

Warns when ref.read is used inside the build method

🛠
warning
#correctness
Pro+
avoid-ref-watch-outside-build

Warns when ref.watch is used outside of the build method

🛠
warning
#correctness
Pro+
avoid-unnecessary-consumer-widgets

Warns when a ConsumerWidget has an unused ref and can be converted to a regular widget

warning
#correctness#consistency#maintainability
Pro+
dispose-provided-instances

Warns when an instance with a dispose method created inside a provider does not have the dispose method called in ref.onDispose

warning
#correctness#memory-leak
Pro+
use-ref-read-synchronously

Warns when ref.read is called past an await point

warning
#correctness
Pro+

Equatable 2 rules

note
Lint rules for the Equatable package.
extend-equatable

Warns when a class that matches the config does not extend Equatable

⚙️
warning
#correctness#requires-config
Pro+
list-all-equatable-fields

Warns when a field is not added to props getter of a class that extends Equatable or EquatableMixin

🛠
warning
#correctness
Pro+

Flame 4 rules

note
Lint rules for the Flame package.
avoid-creating-vector-in-update

Warns when a Vector2 is created inside a Component's update method

🛠
warning
#correctness
Pro+
avoid-initializing-in-on-mount

Warns when a late final variable is being initialized in the Component's onMount method

warning
#correctness
Pro+
avoid-redundant-async-on-load

Warns when a Component's onLoad method can be made sync

🛠
warning
#correctness
Pro+
correct-game-instantiating

Warns when a game is instantiated in a StatelessWidget build method

🛠
warning
#correctness
Pro+

Patrol 2 rules

note
Lint rules for the Patrol package.
prefer-custom-finder-over-find

Suggests using custom finders instead of find in Patrol tests

style
#consistency#readability
Pro+
prefer-symbol-over-key

Suggests using symbols instead of string keys in Patrol tests

style
#consistency#readability
Pro+

Fake Async 1 rule

note
Lint rules for the Fake Async package.
avoid-async-callback-in-fake-async

Warns when an async callback is passed to FakeAsync

🛠
warning
#correctness
Pro+

Get It 1 rule

note
Lint rules for the Get It package.
avoid-functions-in-register-singleton

Warns when a function is passed to registerSingleton

warning
#correctness
Pro+

Flutter Hooks 6 rules

note
avoid-conditional-hooks

Warns when hooks inside the build method or other hooks are called conditionally

warning
#correctness
Pro+
avoid-hooks-outside-build

Warns when a hook is used outside the build method, other hooks or HookBuilder

⚙️
warning
#correctness
Pro+
avoid-misused-hooks

Warns when hooks are used in non-hook widgets

warning
#correctness
Pro+
avoid-unnecessary-hook-widgets

Warns when a hook widget or HookBuilder does not use hooks

warning
#correctness#maintainability
Pro+
prefer-use-callback

Suggests using useCallback instead of useMemoized when applicable

🛠
style
#consistency#readability
Pro+
prefer-use-prefix

Suggests renaming hooks to start with use

style
#consistency#readability#maintainability
Pro+

Firebase Analytics 2 rules

note
incorrect-firebase-event-name

Warns when the event name does not comply with Firebase limitations

warning
#correctness
Pro+
incorrect-firebase-parameter-name

Warns when the parameter name does not comply with Firebase limitations

warning
#correctness
Pro+

GetX 5 rules

note
Lint rules for the GetX package.
always-remove-getx-listener

Warns when a GetX event listener is added but never removed

warning
#correctness#memory-leak
Pro+
avoid-getx-rx-inside-build

Warns when GetX Rx primitives are instantiated inside the build method

warning
#correctness
Pro+
avoid-mutable-rx-variables

Warns when GetX Rx primitives are declared as mutable variables

🛠
warning
#correctness
Pro+
dispose-getx-fields

Warns when a widget state field is not disposed in the onClose method

warning
#correctness#memory-leak
Pro+
proper-getx-super-calls

Checks that super calls in the onStart, onInit, onClose and onDelete methods are called in the correct order

🛠
warning
#correctness
Pro+

Pubspec 9 rules

caution
Pub rules should be added to the pubspec-rules: config section.
avoid-any-version

Warns when a dependency version is set as any

warning
#maintainability
Pro+
avoid-dependency-overrides

Warns when a pubspec file has the dependency_overrides section

warning
#maintainability
Pro+
banned-dependencies

Warns when a pubspec contains a banned dependency

⚙️
warning
#maintainability#requires-config
Pro+
prefer-caret-version-syntax

Warns when a dependency version is listed not with the caret syntax

warning
#maintainability
Pro+
prefer-correct-package-name

Warns when a package name does not match the config

⚙️
warning
#consistency#requires-config
Pro+
prefer-correct-screenshots

Warns when a screenshots section has incorrect entries

warning
#correctness
Pro+
prefer-pinned-version-syntax

Warns when a dependency version is not specified as the exact version

warning
#maintainability
Pro+
prefer-publish-to-none

Warns when a pubspec file does not have publish_to: none config

warning
#maintainability
Pro+
prefer-semver-version

Warns when a package version does not match the semantic versioning approach

warning
#consistency#maintainability
Pro+

Intl 6 rules

note
Lint rules for the Intl package.
prefer-date-format

Warns when DateTime, values are formatted with toString instead of DateFormat.format()

⚙️🛠
warning
#correctness
Pro+
prefer-intl-name

Recommends to use ClassName_ClassMemberName pattern for Intl methods name argument

🛠
style
#consistency#readability
Pro+
prefer-number-format

Warns when int, num or double values are formatted with toString instead of NumberFormat.format()

⚙️🛠
warning
#correctness
Pro+
prefer-providing-intl-description

Warns when an Intl method invoked without a description

warning
#maintainability
Pro+
prefer-providing-intl-examples

Warns when an Intl method invoked without an examples argument or has it incomplete

warning
#maintainability
Pro+
provide-correct-intl-args

Warns when the Intl.message() invocation has incorrect args

warning
#correctness
Pro+

Easy Localization 1 rule

note
avoid-missing-tr

Warns when the tr extension method is not called on localization keys

🛠
warning
#correctness
Pro+

Angular 3 rules

avoid-preserve-whitespace-false

Warns when a @Component annotation has explicit false value for preserveWhitespace

⚠️
warning
#correctness
Pro+
component-annotation-arguments-ordering

Enforces Angular @Component annotation arguments ordering

⚙️⚠️
style
#consistency#readability
Pro+
prefer-on-push-cd-strategy

Prefer setting changeDetection: ChangeDetectionStrategy.OnPush in Angular @Component annotations

⚠️
warning
#correctness
Pro+
No rules found with provided filter criteria.