facebook pixelCodiga Analysis Dart Rules, category best practice
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_USE_PACKAGE_IMPORTS

Best practice
Error

Avoid relative imports.

Learn more

ANNOTATE_OVERRIDES

Best practice
Warning

Annotate overridden members.

AVOID_DYNAMIC_CALLS

Best practice
Error

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

https://dart-lang.github.io/linter/lints/avoid_returning_null_for_void.html

Best practice
Critical

Avoid returning null for void

CONST_EVAL_THROWS_EXCEPTION

Best practice
Error

Eval throws exception.

LEADING_NEWLINES_IN_MULTILINE_STRINGS

Best practice
Warning

Start multiline strings with a newline.

UNNECESSARY_IMPORT

Best practice
Informational

Unnecessary import

UNNECESSARY_TYPE_CHECK

Best practice
Warning

Unnecessary type check

BODY_MIGHT_COMPLETE_NORMALLY_NULLABLE

Best practice
Warning

The analyzer produces this diagnostic when a method or function can implicitly return null by falling off the end. While this is valid Dart code, it’s better for the return of null to be explicit.

UNNECESSARY_QUESTION_MARK

Best practice
Warning

The ‘?’ is unnecessary because the value is nullable without it.

PREFER_FINAL_FIELDS

Best practice
Warning

Field could be final.

PREFER_GENERIC_FUNCTION_TYPE_ALIASES

Best practice
Warning

Prefer generic function type aliases.

AVOID_IMPLEMENTING_VALUE_TYPES

Best practice
Warning

Don't implement classes that override `==`.

UNNECESSARY_OVERRIDES

Best practice
Warning

Don't override a method to do a super method invocation with the same parameters.

DUPLICATE_PART

Best practice
Warning

The library already contains a part.

INVALID_LANGUAGE_VERSION_OVERRIDE

Best practice
Warning

The language version override must be specified before any declaration or directive.

USE_KEY_IN_WIDGET_CONSTRUCTORS

Best practice
Error

Use key in widget constructors.

MUST_BE_A_NATIVE_FUNCTION_TYPE

Best practice
Warning

Type given must be a valid native function type

NON_CONSTANT_TYPE_ARGUMENT

Best practice
Warning

The type arguments to must be known at compile time, so they can’t be type parameters

SUBTYPE_OF_DISALLOWED_TYPE

Best practice
Warning

Type can’t be used as a superclass constraint.