facebook pixelCodiga Analysis Dart Rules, severity warning
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.

ARGUMENT_TYPE_NOT_ASSIGNABLE

Code style
Warning

Invalid assignments

ASSET_DOES_NOT_EXIST

Code style
Warning

Asset does not exists

BODY_MIGHT_COMPLETE_NORMALLY

Code style
Warning

The body might complete normally

CAST_TO_NON_TYPE

Code style
Warning

The name isn't a type

CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE

Code style
Warning

Const variables must be initialized with a constant value.

CONST_WITH_NON_CONSTANT_ARGUMENT

Code style
Warning

Arguments of a constant creation must be constant expressions.

COULD_NOT_INFER

Code style
Warning

Cannot infer type

CREATION_WITH_NON_TYPE

Code style
Warning

The name 'BubbleStyle' isn't a class.\n

DEFAULT_LIST_CONSTRUCTOR

Code style
Warning

The default 'List' constructor isn't available when null safety is enabled.

EXPECTED_TOKEN

Code style
Warning

Expected to find '['.

EXTENDS_NON_CLASS

Code style
Warning

Classes can only extend other classes.

EXTRA_POSITIONAL_ARGUMENTS

Code style
Warning

Too many positional arguments.

GETTER_NOT_SUBTYPE_SETTER_TYPES

Code style
Warning

Invalid return type

IMPLEMENTS_NON_CLASS

Code style
Warning

Classes and mixins can only implement other classes and mixins.

INCLUDE_FILE_NOT_FOUND

Code style
Warning

Include file not found

INVALID_ASSIGNMENT

Code style
Warning

Invalid assignments

INVALID_CONSTANT

Code style
Warning

Invalid constant value

INVALID_OVERRIDE

Code style
Warning

Invalid override

LIST_ELEMENT_TYPE_NOT_ASSIGNABLE

Code style
Warning

List element type not assignable

MISSING_DEFAULT_VALUE_FOR_PARAMETER

Code style
Warning

Missing default value for parameter

MISSING_IDENTIFIER

Code style
Warning

Expected an identifier.

MISSING_REQUIRED_PARAM

Code style
Warning

Missing required parameters

MIXIN_OF_NON_CLASS

Code style
Warning

Classes can only mix in mixins and classes.

MIXIN_WITH_NON_CLASS_SUPERCLASS

Code style
Warning

Mixin can only be applied to class.

NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT

Code style
Warning

The class doesn't have a default constructor.

NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER

Code style
Warning

Missing concrete implementations of methods

NON_BOOL_CONDITION

Code style
Warning

Conditions must have a static type of 'bool'

NON_CONSTANT_CASE_EXPRESSION

Code style
Warning

Case expressions must be constant

NON_CONSTANT_DEFAULT_VALUE

Code style
Warning

The default value of an optional parameter must be constant

NON_CONSTANT_LIST_ELEMENT

Code style
Warning

The values in a const list literal must be constants

NON_CONSTANT_MAP_VALUE

Code style
Warning

The values in a const map literal must be constant

NON_TYPE_AS_TYPE_ARGUMENT

Code style
Warning

The name isn't a type so it can't be used as a type argument

NON_TYPE_IN_CATCH_CLAUSE

Code style
Warning

The name isn't a type and can't be used in an on-catch clause.

NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE

Code style
Warning

The non-nullable local variable must be assigned before it can be used.

NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD

Code style
Warning

Non-nullable instance field must be initialized.

NOT_INITIALIZED_NON_NULLABLE_VARIABLE

Code style
Warning

The non-nullable variable must be initialized.

POSITIONAL_AFTER_NAMED_ARGUMENT

Code style
Warning

Positional arguments must occur before named arguments.

RETURN_OF_INVALID_TYPE

Code style
Warning

Invalid return type

RETURN_OF_INVALID_TYPE_FROM_CLOSURE

Code style
Warning

Invalid return type from closure

TYPE_TEST_WITH_UNDEFINED_NAME

Code style
Warning

Undefined name

UNCHECKED_USE_OF_NULLABLE_VALUE

Code style
Warning

Method can't be unconditionally invoked because the receiver can be 'null'.

UNDEFINED_CONSTRUCTOR_IN_INITIALIZER

Code style
Warning

Undefined constructor

UNDEFINED_GETTER

Code style
Warning

Undefined getter

UNDEFINED_NAMED_PARAMETER

Code style
Warning

Named parameter undefined

UNDEFINED_SETTER

Code style
Warning

Undefined setter

UNDEFINED_SUPER_MEMBER

Code style
Warning

Undefined super member

UNNECESSARY_NON_NULL_ASSERTION

Code style
Warning

Uneccessary non null assertion

URI_HAS_NOT_BEEN_GENERATED

Code style
Warning

URI has not been generated

ANNOTATE_OVERRIDES

Best practice
Warning

Annotate overridden members.

Learn more

CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH

Error prone
Warning

Type mismatch in constructor parameter

LEADING_NEWLINES_IN_MULTILINE_STRINGS

Best practice
Warning

Start multiline strings with a newline.

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_DEV_DEPENDENCY

Error prone
Warning

The dev dependency is unnecessary because there is also a normal dependency on that package.

UNNECESSARY_QUESTION_MARK

Best practice
Warning

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

NO_LEADING_UNDERSCORES_FOR_LOCAL_IDENTIFIERS

Code style
Warning

Avoid leading underscores for local identifiers.

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 `==`.

AVOID_SETTERS_WITHOUT_GETTERS

Design
Warning

Avoid setters without getters.

CONSTANT_IDENTIFIER_NAMES

Code style
Warning

Prefer using lowerCamelCase for constant names.

UNNECESSARY_OVERRIDES

Best practice
Warning

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

DUPLICATE_DEFINITION

Error prone
Warning

Name already defined.

DUPLICATE_PART

Best practice
Warning

The library already contains a part.

EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED

Error prone
Warning

Too many positional arguments.

INVALID_LANGUAGE_VERSION_OVERRIDE

Best practice
Warning

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

DUPLICATE_IGNORE

Error prone
Warning

Diagnostic doesn't need to be ignored here because it's already being ignored

ASSET_DIRECTORY_DOES_NOT_EXIST

Error prone
Warning

The asset directory doesn't exist.

CONST_WITH_NON_CONST

Error prone
Warning

The constructor being called isn't a const constructor.

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.