facebook pixelCodiga Analysis Dart Rules, severity error
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_DECLARE_RETURN_TYPES

Code style
Error

Method should have return type

AVOID_PRINT

Code style
Error

Avoid `print` calls in production code.

ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE

Code style
Error

Illegal assignment to non-assignable expression.

MISSING_ASSIGNABLE_SELECTOR

Code style
Error

Missing selector

MISSING_REQUIRED_ARGUMENT

Code style
Error

Missing required argument

NO_DEFAULT_SUPER_CONSTRUCTOR

Code style
Error

No default super constructor

PREFER_CONST_DECLARATIONS

Code style
Error

Prefer const over final for declarations

PREFER_FINAL_LOCALS

Code style
Error

Prefer final for variable declarations if they are not reassigned.

REDIRECT_TO_NON_CLASS

Code style
Error

Name isn't a type and can't be used in a redirected constructor.

SORT_CHILD_PROPERTIES_LAST

Code style
Error

Sort child properties last in widget instance creations.

TYPE_ANNOTATE_PUBLIC_APIS

Code style
Error

Type annotate public APIs.

TYPE_ARGUMENT_NOT_MATCHING_BOUNDS

Code style
Error

Type arguments do not match bounds

UNDEFINED_OPERATOR

Code style
Error

Undefined operator

UNNECESSARY_THIS

Code style
Error

Unecessary this

UNSUPPORTED_OPERATOR

Code style
Error

The '===' operator is not supported

USE_OF_VOID_RESULT

Code style
Error

Use of void results

ALWAYS_USE_PACKAGE_IMPORTS

Best practice
Error

Avoid relative imports.

Learn more

AVOID_DYNAMIC_CALLS

Best practice
Error

Avoid method calls or property accesses on a "dynamic" target

AVOID_RETURNING_NULL_FOR_VOID

Safety
Error

Avoid returning null for void

CONST_EVAL_THROWS_EXCEPTION

Best practice
Error

Eval throws exception.

NOT_ENOUGH_POSITIONAL_ARGUMENTS

Error prone
Error

Incorrect number of arguments passed to function call

NULL_ARGUMENT_TO_NON_NULL_TYPE

Safety
Error

Function/method shouldn’t be called with a null argument for the non-nullable type argument.

DUPLICATE_NAMED_ARGUMENT

Error prone
Error

The argument was already specified.

INSTANCE_ACCESS_TO_STATIC_MEMBER

Error prone
Error

Static method can't be accessed through an instance.

INVALID_RETURN_TYPE_FOR_CATCH_ERROR

Design
Error

Invalid return type value

LIBRARY_PRIVATE_TYPES_IN_PUBLIC_API

Design
Error

Using library private types in public APIs

UNRELATED_TYPE_EQUALITY_CHECKS

Error prone
Error

Equality operator `==` invocation with references of unrelated types

USE_KEY_IN_WIDGET_CONSTRUCTORS

Best practice
Error

Use key in widget constructors.

PREFER_VOID_TO_NULL

Safety
Error

Don't use the Null type, unless you are positive that you don't want void.

NOT_A_TYPE

Error prone
Error

Mentioned type is not a type