Rules
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
Warns when multiple nested if statements can be merged into one.
Warns when a file has duplicate imports which differ only in name prefix.
Warns when a variable is declared with an explicit type that can be omitted.
Warns when a function or method has a too long parameter list.
Warns when a switch case body has another switch statement.
Checks for else
blocks that can be removed without changing semantics.
Warns when a variable or a class instance field / property is assigned to itself.
Warns when a declaration name shadows another declaration with the same name in the current scope.
Checks for names within the scope that are very similar and thus confusing.
Warns when the return type of a function or a method is declared nullable, but the function or method always return non-nullable value.
Warns when a test
or testWidgets
name doesn't follow the configured pattern.
Warns when a class with no non-final fields has a non-constant constructor declaration.
Warns when a Future is returned from a try / catch block without an await
.
Checks for unnecessary trailing commas for arguments, parameters, enum values and collections.
Flutter
Warns when a class that matches the config does not declare a copyWith
method.
Checks if all the parameters from the default constructor are included in the copyWith
method.
Checks that super
calls in the initState
and dispose
methods are called in the correct order.
Bloc
Warns when a Bloc
has public methods except the overridden ones.
Warns when a Bloc
is provided not with a BlocProvider
.
Warns when a BlocProvider
/ BlocListener
/ RepositoryProvider
can be replace with a Multi
version.
Equatable
Warns when a class that matches the config does not extend Equatable
.
Warns when a field is not added to props
getter of a class that extends Equatable
or EquatableMixin
.
Pubspec
Pub rules should be added to the pubspec-rules:
config section.
Warns when a pubspec file has the dependency_overrides
section.
Warns when a dependency version is listed not with the caret syntax.
Warns when a package name does not match the config.
Warns when a screenshots section has incorrect entries.
Warns when a pubspec file does not have publish_to: none
config.
Warns when a package version does not match the semantic versioning approach.