Rules
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
Dartβ
Enforces named argument order in function and constructor invocations to be the same as corresponding named parameter declaration order. style βοΈπ
Configure some imports that you want to ban. warning βοΈ
Warns when a cascade expression is used after if null (??) binary expression without parentheses. warning
Avoid using collection methods with unrelated types, such as accessing a map of integers using a string key. warning
Warns when an import/export directive contains a double slash. warning π
Warns when a file has multiple exports declarations with the same URI. warning π
Warns when dynamic type is used as variable type in declaration, return type of a function, etc. warning
Warns about usage mutable global variables. warning
Warns when a return value of a method or function invocation or a class instance property access is not used. warning
Warns when a field or variable is declared with a late keyword. warning βοΈπ
Warns when a enum constant is missing in a map declaration. warning
Warns about nested conditional expressions. style
Warns when a string literal contains non ascii characters. warning
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. warning
Warns when an asynchronous function is used as an argument where a synchronous function is expected. warning
Checks for redundant async in a method or function body. warning π
Warns when call throw in a catch block. warning
Warns when a public top-level member (except the entrypoint) is declared inside a test file. warning π
Checks for unnessesary conditional expressions. warning π
Warns about unnecessary usage of is and whereType operators. warning
Warns about unnecessary usage of as operators. warning
Warns about unrelated usages of is operators. warning
Checks for unused parameters inside a function or method body. warning π
Configure some names that you want to ban. warning βοΈ
Warns when a literal value is on the left hand side in a binary expressions. style π
Checks that double literals should begin with 0. instead of just ., and should not end with a trailing 0. style π
Prefer format comments like sentences. style βοΈπ
Warns when a field is not added to props getter of a class that extends Equatable or EquatableMixin. warning π
Enforces ordering for a class members. style βοΈπ
Warns that there is no assertion in the test. warning βοΈ
Enforces blank line between statements and return in a block. style βοΈπ
Warns on comparison to a boolean literal, as in x == true. style π
Disallows empty blocks except catch clause block. style
Warns when equal arguments are passed to a function or method invocation. warning βοΈ
Warns when if statement has equal then and else statements or conditional expression has equal then and else expressions. warning π
Warns against using number literals outside of named constants or variables. warning βοΈ
Warns when a class member is declared with Object type. style
Recommends to use async/await syntax to handle a Future result instead of .then() invocation. style
Warns when // ignore: comments are left without any additional description why this ignore is applied. warning
Recommends to use a conditional expression instead of assigning to the same thing or return statement in each branch of an if statement. style βοΈπ
Warns when an identifier name length is very short or long. style βοΈ
Warns if the file within /test contains a main, but the file name doesn't end with _test.dart. warning
Type name should only contain alphanumeric characters, start with an uppercase character and span between min-length and max-length characters in length. style βοΈ
Since Dart 2.15 it's possible to use byName method on enum values prop instead of searching the value with firstWhere. style
Use first to gets the first element. style π
Warns when a method or a function returns a variable declared right before the return statement. style π
Warns when List.from() factory is used instead of List.of(). warning π
Use last to gets the last element. style π
Warns when a file name does not match the class name. warning π
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 βοΈ
Suggests to use static class member instead of global constants, variables and functions. style βοΈ
Checks for a trailing comma for arguments, parameters, enum values and collections. style βοΈπ
Warns when a tag name does not match the class name. warning βοΈπ
Flutter specificβ
Warns when an event listener is added but never removed. warning
Avoid using Border.all constructor. performance π
Warns when a method or function returns a Widget or subclass of a Widget. warning βοΈ
Warns when a ListView widget with shrinkWrap parameter is wrapped in a Column, Row or another ListView widget. performance
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
Warns when setState is called past an await point. warning βοΈ
Avoid using Expanded widget as Spacer. warning π
Warns when a widget is wrapped in a Padding widget but has a padding settings by itself. warning
Warns when a RenderObject setter doesn't have an equality check for the new value. warning
Warns when an updateRenderObject method is absent or doesn't update all fields set in createRenderObject. warning
Warns when a non-const border radius is used. performance π
Prefer correct EdgeInsets constructor. style π
Warns about inline callbacks in a widget tree and suggest to extract them to a widget method. style βοΈ
Warns when a file contains more than a single widget. style βοΈ
Warns when a Column widget with only children parameter is wrapped in a SingleChildScrollView widget. performance
Flameβ
Lints for the Flame package.
Warns when a Vector2 is created inside a Component's update method. warning
Warns when a late final variable is being initialized in the Component's onMount method. warning
Warns when a Component's onLoad method can be made sync. warning π
Intl specificβ
Recommends to use ClassName_ClassMemberName pattern for Intl methods name argument. style π
Warns when a Intl method invoked without a description. warning