facebook pixelCodiga Analysis Dart Rules, severity informational
BACK TO LIST

Dart rules

Codiga provides multiple sets of rules for 12+ languages. Below we provide a link and a description for all the rules supported by our platform. Note that not all the rules are being listed and described below.

always_specify_types

Code style
Informational

Always specify types

AVOID_BOOL_LITERALS_IN_CONDITIONAL_EXPRESSIONS

Code style
Informational

Avoid bool literals in condition

AVOID_CLASSES_WITH_ONLY_STATIC_MEMBERS

Code style
Informational

Avoid defining a class that contains only static members.

AVOID_ESCAPING_INNER_QUOTES

Code style
Informational

Avoid escaping inner quotes by converting surrounding quotes.

AVOID_FUNCTION_LITERALS_IN_FOREACH_CALLS

Code style
Informational

Avoid using `forEach` with a function literal.

avoid_init_to_null

Code style
Informational

Don't explicitly initialize variables to null.

AVOID_POSITIONAL_BOOLEAN_PARAMETERS

Code style
Informational

Avoid positional boolean parameters.

AVOID_REDUNDANT_ARGUMENT_VALUES

Code style
Informational

Avoid redundant argument values.

AVOID_RETURN_TYPES_ON_SETTERS

Code style
Informational

Avoid return types on setters.

AVOID_UNNECESSARY_CONTAINERS

Code style
Informational

Avoid unnecessary containers.

AVOID_VOID_ASYNC

Code style
Informational

Avoid async functions that return void.

AVOID_WEB_LIBRARIES_IN_FLUTTER

Code style
Informational

Avoid using web-only libraries outside Flutter web plugin packages.

AWAIT_ONLY_FUTURES

Code style
Informational

await' should only apply to futures

CAMEL_CASE_TYPES

Code style
Informational

Name types using UpperCamelCase.

CAST_NULLABLE_TO_NON_NULLABLE

Code style
Informational

Don't cast a nullable value to a non nullable type.

close_sinks

Code style
Informational

Close instances of `dart.core.Sink`.\n

DEAD_CODE

Code style
Informational

Dead code.

DEAD_CODE_ON_CATCH_SUBTYPE

Code style
Informational

Dead code on catch subtype.

DEAD_NULL_AWARE_EXPRESSION

Code style
Informational

The left operand can't be null.

DEPEND_ON_REFERENCED_PACKAGES

Code style
Informational

Depend on referenced packages.

DEPRECATED_MEMBER_USE

Code style
Informational

Member is deprecated and shouldn't be used. This property is no longer used

DIRECTIVES_ORDERING

Code style
Informational

Import ordering

DUPLICATE_IMPORT

Code style
Informational

Duplicate import.

EMPTY_CATCHES

Code style
Informational

Avoid empty catch blocks.

empty_constructor_bodies

Code style
Informational

Use `;` instead of `{}` for empty constructor bodies.

empty_statements

Code style
Informational

Detect empty statements (dead code)

EOL_AT_END_OF_FILE

Code style
Informational

Put a single newline at end of file.

FILE_NAMES

Code style
Informational

Name source files using `lowercase\_with\_underscores`.

HASH_AND_EQUALS

Code style
Informational

Override `hashCode` if overriding `==`

implementation_imports

Code style
Informational

Don't import implementation files from another package.

IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE

Code style
Informational

Legacy library

INVALID_ANNOTATION_TARGET

Code style
Informational

Invalid annotation target

INVALID_NULL_AWARE_OPERATOR

Code style
Informational

The receiver can't be null because of short-circuiting

INVALID_USE_OF_PROTECTED_MEMBER

Code style
Informational

Invalid use of protected members

INVARIANT_BOOLEANS

Code style
Informational

Conditions should not unconditionally evaluate to `true` or to `false`.

JOIN_RETURN_WITH_ASSIGNMENT

Code style
Informational

Join return statement with assignment when possible.

LIBRARY_PREFIXES

Code style
Informational

Use `lowercase\_with\_underscores` when specifying a library prefix.

MISSING_ENUM_CONSTANT_IN_SWITCH

Code style
Informational

Missing case clause for 'null'.

MISSING_RETURN

Code style
Informational

Missing return value

MUST_BE_IMMUTABLE

Code style
Informational

Must be immutable

MUST_CALL_SUPER

Code style
Informational

This method overrides a method annotated as '@mustCallSuper' in 'State'

non_constant_identifier_names

Code style
Informational

Name non-constant identifiers using lowerCamelCase

NOOP_PRIMITIVE_OPERATIONS

Code style
Informational

Noop primitive operations.

NULLABLE_TYPE_IN_CATCH_CLAUSE

Code style
Informational

A potentially nullable type can't be used in an 'on' clause because it isn't valid to throw a nullable expression.

OVERRIDDEN_FIELDS

Code style
Informational

Don't override fields.

OVERRIDE_ON_NON_OVERRIDING_MEMBER

Code style
Informational

The field doesn't override an inherited getter or setter.

PREFER_CONST_CONSTRUCTORS

Code style
Informational

Prefer const with constant constructors.

PREFER_CONST_CONSTRUCTORS_IN_IMMUTABLES

Code style
Informational

Prefer declaring const constructors on `@immutable` classes

PREFER_CONST_LITERALS_TO_CREATE_IMMUTABLES

Code style
Informational

Prefer const literals as parameters of constructors on @immutable classes.

PREFER_FINAL_IN_FOR_EACH

Code style
Informational

Prefer final in for-each loop variable if reference is not reassigned.

PREFER_IF_ELEMENTS_TO_CONDITIONAL_EXPRESSIONS

Code style
Informational

Prefer if elements to conditional expressions where possible.

PREFER_IF_NULL_OPERATORS

Code style
Informational

Prefer using if null operators.

PREFER_INITIALIZING_FORMALS

Code style
Informational

Use initializing formals when possible.

PREFER_INTERPOLATION_TO_COMPOSE_STRINGS

Code style
Informational

Use interpolation to compose strings and values.

PREFER_IS_EMPTY

Code style
Informational

Use isEmpty instead of length\n

PREFER_IS_NOT_EMPTY

Code style
Informational

Use `isNotEmpty` for Iterables and Maps.

PREFER_NULL_AWARE_METHOD_CALLS

Code style
Informational

Prefer null aware method calls.

PREFER_TYPING_UNINITIALIZED_VARIABLES

Code style
Informational

Prefer typing uninitialized variables and fields.

REQUIRE_TRAILING_COMMAS

Code style
Informational

Missing a required trailing comma.

SIZED_BOX_FOR_WHITESPACE

Code style
Informational

SizedBox for whitespace.

SORT_PUB_DEPENDENCIES

Code style
Informational

Sort pub dependencies.

unnecessary_brace_in_string_interps

Code style
Informational

Avoid using braces in interpolation when not needed.

UNNECESSARY_CAST

Code style
Informational

Unnecessary cast.

UNNECESSARY_NEW

Code style
Informational

Unnecessary new keyword.

UNNECESSARY_NULL_CHECKS

Code style
Informational

Unnecessary null checks

UNNECESSARY_NULL_COMPARISON

Code style
Informational

The operand can't be null

UNNECESSARY_PARENTHESIS

Code style
Informational

Unnecessary parenthesis

unnecessary_statements

Code style
Informational

Avoid using unnecessary statements

UNNECESSARY_STRING_INTERPOLATIONS

Code style
Informational

Unnecessary string interpolation

UNUSED_CATCH_CLAUSE

Code style
Informational

Unused catch clause

UNUSED_CATCH_STACK

Code style
Informational

Stack trace not used

UNUSED_ELEMENT

Code style
Informational

Unused element

UNUSED_FIELD

Code style
Informational

Unused fiel

UNUSED_IMPORT

Code style
Informational

Unused import

UNUSED_LABEL

Code style
Informational

Unused label

UNUSED_LOCAL_VARIABLE

Code style
Informational

Unused local variable

USE_BUILD_CONTEXT_SYNCHRONOUSLY

Code style
Informational

Use build context synchronuously

USE_LATE_FOR_PRIVATE_FIELDS_AND_VARIABLES

Code style
Informational

Use late for private members with non-nullable type.

USE_NAMED_CONSTANTS

Code style
Informational

Use named constants

USE_STRING_BUFFERS

Code style
Informational

Use string buffers to compose strings

UNNECESSARY_IMPORT

Best practice
Informational

Unnecessary import

Learn more

DIRECTIVE_AFTER_DECLARATION

Code style
Informational

Directives must appear before any declarations.

FLUTTER_STYLE_TODOS

Code style
Informational

Use Flutter TODO format.

NO_LEADING_UNDERSCORES_FOR_LIBRARY_PREFIXES

Code style
Informational

Avoid leading underscores for library prefixes.

INVALID_FACTORY_NAME_NOT_A_CLASS

Code style
Informational

The name of a factory constructor must be the same as the name of the immediately enclosing class.