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

Common​

arguments-ordering

Enforces named argument order in function and constructor invocations to be the same as corresponding named parameter declaration order.

added in: 1.6.0
style
βš™οΈπŸ› 
avoid-accessing-other-classes-private-members

Warns when a private member of another class is used.

added in: 1.7.0
warning
avoid-async-call-in-sync-function

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

added in: 1.8.0
warning
avoid-banned-file-names

Configure file names that you want to ban.

added in: 1.4.0
warning
βš™οΈ
avoid-banned-imports

Configure some imports that you want to ban.

added in: 1.6.0
warning
βš™οΈ
avoid-banned-types

Configure types that you want to ban.

added in: 1.4.0
warning
βš™οΈ
avoid-barrel-files

Warns when a file is a barrel file.

added in: 1.7.0
warning
avoid-bottom-type-in-patterns

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

added in: 1.5.0
warning
Dart 3.0
avoid-bottom-type-in-records

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

added in: 1.5.0
warning
Dart 3.0
avoid-cascade-after-if-null

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

added in: 1.6.0
warning
avoid-collapsible-if

Warns when multiple nested if statements can be merged into one.

added in: 1.1.0
style
πŸ› 
avoid-collection-methods-with-unrelated-types

Avoid using collection methods with unrelated types, such as accessing a map of integers using a string key.

added in: 1.6.0
warning
avoid-declaring-call-method

Warns when a class has a call method.

added in: 1.3.0
warning
πŸ› 
avoid-double-slash-imports

Warns when an import/export directive contains a double slash.

added in: 1.6.0
warning
πŸ› 
avoid-duplicate-exports

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

added in: 1.6.0
warning
πŸ› 
avoid-duplicate-mixins

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

added in: 1.8.0
warning
avoid-duplicate-named-imports

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

added in: 1.2.0
warning
avoid-duplicate-patterns

Warns when a LogicalOrPattern or LogicalAndPattern contains duplicated patterns.

added in: 1.5.0
warning
Dart 3.0
avoid-dynamic

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

added in: 1.6.0
warning
avoid-equal-expressions

Warns when both sides of a binary expression are the same.

added in: 1.3.0
warning
avoid-explicit-pattern-field-name

Warns when an object pattern has an explicit field name.

added in: 1.5.0
style
πŸ› 
Dart 3.0
avoid-explicit-type-declaration

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

added in: 1.1.0
style
πŸ› 
avoid-function-type-in-records

Warns when a record type declaration contains a function type.

added in: 1.5.0
style
Dart 3.0
avoid-future-tostring

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

added in: 1.6.0
warning
avoid-generics-shadowing

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

added in: 1.7.0
warning
avoid-global-state

Warns about usage mutable global variables.

added in: 1.6.0
warning
avoid-identical-exception-handling-blocks

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

added in: 1.9.0
warning
avoid-ignoring-return-values

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

added in: 1.6.0
warning
avoid-importing-entrypoint-exports

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

added in: 1.7.0
style
βš™οΈ
avoid-inverted-boolean-checks

Warns when a condition has an inverted check.

added in: 1.4.0
style
avoid-keywords-in-wildcard-pattern

Warns when a wildcard pattern has declaration keywords.

added in: 1.7.0
style
πŸ› 
Dart 3.0
avoid-late-keyword

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

added in: 1.6.0
warning
βš™οΈπŸ› 
avoid-long-functions

Warns when a function or method has a too long body.

added in: 1.2.0
warning
βš™οΈ
avoid-long-parameter-list

Warns when a function or method has a too long parameter list.

added in: 1.2.0
warning
βš™οΈ
avoid-long-records

Warns when a record has too many fields.

added in: 1.5.0
warning
βš™οΈ
Dart 3.0
avoid-map-keys-contains

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

added in: 1.8.0
warning
avoid-missed-calls

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

added in: 1.3.0
warning
πŸ› 
avoid-missing-enum-constant-in-map

Warns when a enum constant is missing in a map declaration.

added in: 1.6.0
warning
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.

added in: 1.9.0
warning
avoid-misused-wildcard-pattern

Warns when a wildcard pattern is used in the wrong context.

added in: 1.7.0
warning
Dart 3.0
avoid-mixing-named-and-positional-fields

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

added in: 1.5.0
style
Dart 3.0
avoid-mutating-parameters

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

added in: 1.7.0
warning
avoid-negated-conditions

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

added in: 1.7.0
style
avoid-nested-conditional-expressions

Warns about nested conditional expressions.

added in: 1.6.0
style
avoid-nested-futures

Warns when a Future type contains another Future.

added in: 1.7.0
warning
avoid-nested-records

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

added in: 1.5.0
style
βš™οΈ
Dart 3.0
avoid-nested-streams-and-futures

Warns when a Stream type contains a Future or vice versa.

added in: 1.7.0
warning
avoid-nested-switch-expressions

Warns when a switch expression contains another switch expression.

added in: 1.5.0
style
βš™οΈ
Dart 3.0
avoid-nested-switches

Warns when a switch case body has another switch statement.

added in: 1.1.0
style
avoid-non-ascii-symbols

Warns when a string literal contains non ascii characters.

added in: 1.6.0
warning
avoid-non-null-assertion

Warns when non null assertion operator ! (or β€œbang” operator) is used for a property access or method invocation. The operator check works at runtime and it may fail and throw a runtime exception.

added in: 1.6.0
warning
avoid-nullable-interpolation

Warns when an interpolation string contains a nullable value.

added in: 1.8.0
warning
βš™οΈ
avoid-one-field-records

Warns when a record has only one field.

added in: 1.5.0
warning
Dart 3.0
avoid-passing-async-when-sync-expected

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

added in: 1.6.0
warning
avoid-passing-default-values

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

added in: 1.9.0
warning
βš™οΈπŸ› 
avoid-passing-self-as-argument

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

added in: 1.9.0
warning
avoid-positional-record-field-access

Warns when a record positional field is accessed via $.

added in: 1.5.0
warning
Dart 3.0
avoid-recursive-calls

Warns when a function calls itself recursively.

added in: 1.9.0
warning
avoid-redundant-async

Checks for redundant async in a method or function body.

added in: 1.6.0
warning
πŸ› 
avoid-redundant-else

Checks for else blocks that can be removed without changing semantics.

added in: 1.1.0
style
πŸ› 
avoid-redundant-positional-field-name

Warns when a record positional field has a name.

added in: 1.5.0
warning
πŸ› 
Dart 3.0
avoid-redundant-pragma-inline

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

added in: 1.4.0
warning
πŸ› 
avoid-referencing-discarded-variables

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

added in: 1.9.0
warning
avoid-self-assignment

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

added in: 1.1.0
warning
πŸ› 
avoid-self-compare

Warns when a comparison has both sides exactly the same.

added in: 1.1.0
warning
avoid-shadowed-extension-methods

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

added in: 1.7.0
warning
avoid-shadowing

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

added in: 1.2.0
warning
βš™οΈ
avoid-similar-names

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

added in: 1.1.0
style
βš™οΈ
avoid-substring

Warns when a String.substring method is used.

added in: 1.6.0
warning
avoid-throw-in-catch-block

Warns when call throw in a catch block.

added in: 1.6.0
warning
avoid-throw-objects-without-tostring

Warns when a thrown object does not implement toString.

added in: 1.4.0
warning
avoid-top-level-members-in-tests

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

added in: 1.6.0
warning
πŸ› 
avoid-unassigned-late-fields-keyword

Warns when a late field is not assigned a value.

added in: 1.6.0
warning
avoid-uncaught-future-errors

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

added in: 1.7.0
warning
avoid-unconditional-break

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

added in: 1.9.0
warning
avoid-unnecessary-call

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

added in: 1.7.0
style
avoid-unnecessary-conditionals

Checks for unnecessary conditional expressions.

added in: 1.6.0
warning
πŸ› 
avoid-unnecessary-futures

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

added in: 1.7.0
warning
πŸ› 
avoid-unnecessary-if

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

added in: 1.9.0
warning
πŸ› 
avoid-unnecessary-negations

Warns when a negation can be simplified.

added in: 1.4.0
warning
πŸ› 
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.

added in: 1.0.0
warning
πŸ› 
avoid-unnecessary-reassignment

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

added in: 1.8.0
warning
avoid-unnecessary-return

Warns when a return statement is unnecessary and can be removed.

added in: 1.6.0
style
πŸ› 
avoid-unnecessary-type-assertions

Warns about unnecessary usage of is and whereType operators.

added in: 1.6.0
warning
avoid-unnecessary-type-casts

Warns about unnecessary usage of as operators.

added in: 1.6.0
warning
avoid-unrelated-type-assertions

Warns about unrelated usages of is operators.

added in: 1.6.0
warning
βš™οΈ
avoid-unrelated-type-casts

Warns about unrelated usages of as operator.

added in: 1.0.0
warning
avoid-unsafe-collection-methods

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

added in: 1.4.0
warning
πŸ› 
avoid-unused-generics

Warns when a function or method declares unused generic types.

added in: 1.4.0
warning
πŸ› 
avoid-unused-instances

Warns when a newly created object is not being used.

added in: 1.8.0
warning
βš™οΈ
avoid-unused-parameters

Checks for unused parameters inside a function or method body.

added in: 1.6.0
warning
βš™οΈπŸ› 
avoid-weak-cryptographic-algorithms

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

added in: 1.9.0
warning
ban-name

Configure some names that you want to ban.

added in: 1.6.0
warning
βš™οΈβš οΈ
banned-usage

Configure some usages that you want to ban.

added in: 1.3.0
warning
βš™οΈ
binary-expression-operand-order

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

added in: 1.6.0
style
πŸ› 
double-literal-format

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

added in: 1.5.0
style
πŸ› 
enum-constants-ordering

Ensures consistent alphabetical order of Enum constants.

added in: 1.8.0
style
format-comment

Prefer format comments like sentences.

added in: 4.11.0
style
βš™οΈπŸ› 
format-test-name

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

added in: 1.0.0
style
βš™οΈ
function-always-returns-null

Warns when a function with nullable return type returns only nullvalue.

added in: 1.4.0
warning
map-keys-ordering

Ensures consistent alphabetical order of String keys inside a map.

added in: 1.7.0
style
πŸ› 
match-class-name-pattern

Configure class names to match the given pattern.

added in: 1.8.0
style
βš™οΈ
match-positional-field-names-on-assignment

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

added in: 1.5.0
warning
πŸ› 
Dart 3.0
member-ordering

Enforces ordering for a class members.

added in: 1.8.0
style
βš™οΈπŸ› 
missing-test-assertion

Warns that there is no assertion in the test.

added in: 4.21.0
warning
βš™οΈ
move-records-to-typedefs

Warns when a record type should be moved to a typedef.

added in: 1.5.0
warning
βš™οΈ
Dart 3.0
move-variable-closer-to-its-usage

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

added in: 1.9.0
warning
newline-before-case

Enforces a blank line between cases in a switch statement.

added in: 1.8.0
style
πŸ› 
newline-before-return

Enforces a blank line between statements and return in a block.

added in: 1.5.1
style
πŸ› 
no-boolean-literal-compare

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

added in: 1.5.0
style
βš™οΈπŸ› 
no-empty-block

Disallows empty blocks except catch clause block.

added in: 1.6.0
style
no-equal-arguments

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

added in: 1.6.0
warning
βš™οΈ
no-equal-conditions

Warns when a if statement has duplicate conditions.

added in: 1.1.0
warning
no-equal-nested-conditions

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

added in: 1.7.0
warning
no-equal-switch-case

Warns when a switch has cases with equal bodies.

added in: 1.1.0
warning
no-equal-switch-expression-cases

Warns when a switch expression has cases with equal bodies.

added in: 1.5.0
warning
Dart 3.0
no-equal-then-else

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

added in: 1.6.0
warning
πŸ› 
no-magic-number

Warns against using number literals outside of named constants or variables.

added in: 1.6.0
warning
βš™οΈ
no-object-declaration

Warns when a class member is declared with Object type.

added in: 1.6.0
style
parameters-ordering

Ensures consistent alphabetical order of parameters by their names.

added in: 1.9.0
style
πŸ› 
prefer-async-await

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

added in: 1.6.0
style
prefer-bytes-builder

Warns when an expensive byte list operation is used.

added in: 1.3.0
warning
prefer-commenting-analyzer-ignores

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

added in: 1.6.0
warning
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.

added in: 1.6.0
style
βš™οΈπŸ› 
prefer-correct-error-name

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

added in: 1.7.0
style
βš™οΈ
prefer-correct-for-loop-increment

Warns when a for loop increments a wrong variable.

added in: 1.8.0
warning
prefer-correct-future-return-type

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

added in: 1.7.0
warning
πŸ› 
prefer-correct-identifier-length

Warns when an identifier name length is very short or long.

added in: 1.6.0
style
βš™οΈ
prefer-correct-json-casts

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

added in: 1.8.0
warning
prefer-correct-stream-return-type

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

added in: 1.7.0
warning
πŸ› 
prefer-correct-switch-length

Warns when a switch has too few or too many cases.

added in: 1.3.0
style
βš™οΈ
prefer-correct-test-file-name

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

added in: 1.6.0
warning
prefer-correct-type-name

Type name should only contain alphanumeric characters, start with an uppercase character and span between min-length and max-length characters in length.

added in: 1.6.0
style
βš™οΈ
prefer-declaring-const-constructor

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

added in: 1.0.0
performance
βš™οΈπŸ› 
prefer-early-return

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

added in: 1.3.0
style
βš™οΈ
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.

added in: 1.6.0
style
prefer-explicit-parameter-names

Warns when parameter names in function types are omitted.

added in: 1.3.0
style
prefer-first

Use first to gets the first element.

added in: 1.6.0
style
πŸ› 
prefer-getter-over-method

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

added in: 1.9.0
style
prefer-immediate-return

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

added in: 1.6.0
style
πŸ› 
prefer-iterable-of

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

added in: 1.6.0
warning
πŸ› 
prefer-last

Use last to gets the last element.

added in: 1.6.0
style
πŸ› 
prefer-match-file-name

Warns when a file name does not match the class name.

added in: 1.6.0
warning
πŸ› 
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.

added in: 1.6.0
warning
βš™οΈ
prefer-named-boolean-parameters

Warns when a declaration has a boolean positional parameter.

added in: 1.8.0
style
βš™οΈ
prefer-parentheses-with-if-null

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

added in: 1.7.0
warning
prefer-public-exception-classes

Warns when an exception class declaration is not public.

added in: 1.8.0
warning
prefer-return-await

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

added in: 1.2.0
warning
πŸ› 
prefer-returning-conditional-expressions

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

added in: 1.5.0
style
prefer-simpler-patterns-null-check

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

added in: 1.5.0
warning
πŸ› 
Dart 3.0
prefer-static-class

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

added in: 1.6.0
style
βš™οΈ
prefer-test-matchers

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

added in: 1.6.0
warning
prefer-trailing-comma

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

added in: 1.6.0
style
βš™οΈπŸ› 
prefer-type-over-var

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

added in: 1.7.0
style
πŸ› 
prefer-unwrapping-future-or

Warns when a FutureOr is not unwrapped before being used.

added in: 1.4.0
warning
prefer-visible-for-testing-on-members

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

added in: 1.4.0
warning
πŸ› 
prefer-wildcard-pattern

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

added in: 1.5.0
warning
πŸ› 
Dart 3.0
tag-name

Warns when a tag name does not match the class name.

added in: 1.6.0
warning
βš™οΈπŸ› 
unnecessary-trailing-comma

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

added in: 1.2.0
style
βš™οΈπŸ› 

Flutter​

add-copy-with

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

added in: 1.2.0
warning
βš™οΈ
always-remove-listener

Warns when an event listener is added but never removed.

added in: 1.6.0
warning
avoid-border-all

Avoid using Border.all constructor.

added in: 1.6.0
performance
πŸ› 
avoid-empty-setstate

Warns when a setState callback is empty.

added in: 1.3.0
warning
avoid-expanded-as-spacer

Avoid using Expanded widget as Spacer.

added in: 1.6.0
warning
πŸ› 
avoid-incomplete-copy-with

Checks if all the parameters from the default constructor are included in the copyWith method.

added in: 1.1.0
warning
avoid-inherited-widget-in-initstate

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

added in: 1.4.0
warning
avoid-late-context

Warns when the context is used inside a late field.

added in: 1.4.0
warning
avoid-missing-image-alt

Warns when an Image widget does not have a semanticLabel.

added in: 1.7.0
warning
βš™οΈ
avoid-recursive-widget-calls

Warns when a Widget is recursively used within the same Widget.

added in: 1.8.0
warning
avoid-returning-widgets

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

added in: 1.6.0
warning
βš™οΈ
avoid-shrink-wrap-in-lists

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

added in: 1.6.0
performance
avoid-state-constructors

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

added in: 1.4.0
warning
avoid-stateless-widget-initialized-fields

Warns when a StatelessWidget has an initialized final field.

added in: 1.5.0
warning
avoid-unnecessary-overrides-in-state

Warns when a widget's State has unnecessary overrides.

added in: 1.7.0
warning
πŸ› 
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.

added in: 1.6.0
warning
avoid-unnecessary-stateful-widgets

Warns when a StatefulWidget can be converted to a StatelessWidget.

added in: 1.4.0
warning
avoid-wrapping-in-padding

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

added in: 1.6.0
warning
check-for-equals-in-render-object-setters

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

added in: 1.6.0
warning
consistent-update-render-object

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

added in: 1.6.0
warning
dispose-fields

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

added in: 1.3.0
warning
βš™οΈ
prefer-action-button-tooltip

Warns when a FloatingActionButton does not have a tooltip specified.

added in: 1.4.0
warning
prefer-const-border-radius

Warns when a non-const border radius is used.

added in: 1.6.0
performance
πŸ› 
prefer-correct-edge-insets-constructor

Prefer correct EdgeInsets constructor.

added in: 1.6.0
style
πŸ› 
prefer-dedicated-media-query-methods

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

added in: 1.7.0
warning
prefer-define-hero-tag

Warns when a Widget has an unset heroTag.

added in: 1.6.0
warning
prefer-extracting-callbacks

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

added in: 1.6.0
style
βš™οΈ
prefer-single-widget-per-file

Warns when a file contains more than a single widget.

added in: 1.6.0
style
βš™οΈ
prefer-text-rich

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

added in: 1.8.0
warning
prefer-using-list-view

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

added in: 1.6.0
performance
prefer-widget-private-members

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

added in: 1.3.0
style
proper-super-calls

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

added in: 1.2.0
warning
πŸ› 
use-setstate-synchronously

Warns when setState is called past an await point.

added in: 1.6.0
warning
βš™οΈ

Provider​

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.

added in: 1.4.0
warning
avoid-read-inside-build

Warns when a read method is used inside of the build method.

added in: 1.4.0
warning
avoid-watch-outside-build

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

added in: 1.4.0
warning
dispose-providers

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

added in: 1.4.0
warning
prefer-multi-provider

Warns when multiple nested Providers can be replaced with MultiProvider instead.

added in: 1.4.0
warning

Bloc​

note

Lint rules for the Bloc package.

avoid-bloc-public-methods

Warns when a Bloc has public methods except the overridden ones.

added in: 1.2.0
warning
avoid-cubits

Warns when a Cubit is used.

added in: 1.2.0
warning
avoid-passing-bloc-to-bloc

Warns when a Bloc depends on another Bloc.

added in: 1.2.0
warning
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.

added in: 1.4.0
warning
prefer-correct-bloc-provider

Warns when a Bloc is provided not with a BlocProvider.

added in: 1.2.0
warning
prefer-multi-bloc-provider

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

added in: 1.2.0
performance

Equatable​

note

Lint rules for the Equatable package.

extend-equatable

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

added in: 1.2.0
warning
βš™οΈ
list-all-equatable-fields

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

added in: 1.2.0
warning
πŸ› 

Flame​

note

Lint rules for the Flame package.

avoid-creating-vector-in-update

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

added in: 1.6.0
warning
avoid-initializing-in-on-mount

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

added in: 1.6.0
warning
avoid-redundant-async-on-load

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

added in: 1.6.0
warning
πŸ› 
correct-game-instantiating

Warns when a game is instantiated in a stateless widget build method.

added in: 1.6.0
warning
πŸ› 

Patrol​

note

Lint rules for the Patrol package.

prefer-custom-finder-over-find

Suggests using custom finders instead of find in Patrol tests.

added in: 1.8.0
style
prefer-symbol-over-key

Suggests using symbols instead of string keys in Patrol tests.

added in: 1.8.0
style

Fake Async​

note

Lint rules for the Fake Async package.

avoid-async-callback-in-fake-async

Warns when an async callback is passed to FakeAsync.

added in: 1.9.0
warning

Pubspec​

caution

Pub rules should be added to the pubspec-rules: config section.

avoid-any-version

Warns when a dependency version is set as any.

added in: 1.2.0
warning
avoid-dependency-overrides

Warns when a pubspec file has the dependency_overrides section.

added in: 1.2.0
warning
banned-dependencies

Warns when a pubspec contains a banned dependency.

added in: 1.2.0
warning
βš™οΈ
prefer-caret-version-syntax

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

added in: 1.2.0
warning
prefer-correct-package-name

Warns when a package name does not match the config.

added in: 1.2.0
warning
βš™οΈ
prefer-correct-screenshots

Warns when a screenshots section has incorrect entries.

added in: 1.2.0
warning
prefer-publish-to-none

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

added in: 1.2.0
warning
prefer-semver-version

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

added in: 1.2.0
warning

Intl​

note

Lint rules for the Intl package.

prefer-date-format

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

added in: 1.7.0
warning
πŸ› 
prefer-intl-name

Recommends to use ClassName_ClassMemberName pattern for Intl methods name argument.

added in: 1.6.0
style
πŸ› 
prefer-number-format

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

added in: 1.6.0
warning
πŸ› 
prefer-provide-intl-description

Warns when a Intl method invoked without a description.

added in: 1.6.0
warning
provide-correct-intl-args

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

added in: 1.6.0
warning

Angular​

avoid-preserve-whitespace-false

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

added in: 1.6.0
warning
component-annotation-arguments-ordering

Enforces Angular @Component annotation arguments ordering.

added in: 1.6.0
style
βš™οΈ
prefer-on-push-cd-strategy

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

added in: 1.6.0
warning