Skip to main content

Rules

info

This page displays rules available only for "Teams" version. To see rules avaiable for everyone, refer to this page.

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

avoid-collapsible-if

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

added in: 1.1.0
style
🛠
avoid-duplicate-named-imports

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

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

Warns when a switch case body has another switch statement.

added in: 1.1.0
style
avoid-redundant-else

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

added in: 1.1.0
style
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-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-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-unrelated-type-casts

Warns about unrelated usages of as operator.

added in: 1.0.0
warning
format-test-name

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

added in: 1.0.0
style
⚙️
no-equal-switch-case

Warns when a switch has cases with equal bodies.

added in: 1.1.0
warning
no-equal-conditions

Warns when a if statement has duplicate conditions.

added in: 1.1.0
warning
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-return-await

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

added in: 1.2.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
⚙️
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
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
🛠

Bloc

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
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

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
🛠

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