facebook pixelDART Static Code Analysis Rules
BACK TO LIST

Dart rules

Codiga provides multiple set 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
      Minor

      Always specify types

      AVOID_BOOL_LITERALS_IN_CONDITIONAL_EXPRESSIONS

      Code style
      Minor

      Avoid bool literals in condition

      AVOID_CLASSES_WITH_ONLY_STATIC_MEMBERS

      Code style
      Minor

      Avoid defining a class that contains only static members.

      AVOID_ESCAPING_INNER_QUOTES

      Code style
      Minor

      Avoid escaping inner quotes by converting surrounding quotes.

      AVOID_FUNCTION_LITERALS_IN_FOREACH_CALLS

      Code style
      Minor

      Avoid using `forEach` with a function literal.

      avoid_init_to_null

      Code style
      Minor

      Don't explicitly initialize variables to null.

      AVOID_POSITIONAL_BOOLEAN_PARAMETERS

      Code style
      Minor

      Avoid positional boolean parameters.

      AVOID_REDUNDANT_ARGUMENT_VALUES

      Code style
      Minor

      Avoid redundant argument values.

      AVOID_RETURN_TYPES_ON_SETTERS

      Code style
      Minor

      Avoid return types on setters.

      AVOID_UNNECESSARY_CONTAINERS

      Code style
      Minor

      Avoid unnecessary containers.

      AVOID_VOID_ASYNC

      Code style
      Minor

      Avoid async functions that return void.

      AVOID_WEB_LIBRARIES_IN_FLUTTER

      Code style
      Minor

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

      AWAIT_ONLY_FUTURES

      Code style
      Minor

      await' should only apply to futures

      CAMEL_CASE_TYPES

      Code style
      Minor

      Name types using UpperCamelCase.

      CAST_NULLABLE_TO_NON_NULLABLE

      Code style
      Minor

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

      close_sinks

      Code style
      Minor

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

      DEAD_CODE

      Code style
      Minor

      Dead code.

      DEAD_CODE_ON_CATCH_SUBTYPE

      Code style
      Minor

      Dead code on catch subtype.

      DEAD_NULL_AWARE_EXPRESSION

      Code style
      Minor

      The left operand can't be null.

      DEPEND_ON_REFERENCED_PACKAGES

      Code style
      Minor

      Depend on referenced packages.

      DEPRECATED_MEMBER_USE

      Code style
      Minor

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

      DIRECTIVES_ORDERING

      Code style
      Minor

      Import ordering

      DUPLICATE_IMPORT

      Code style
      Minor

      Duplicate import.

      EMPTY_CATCHES

      Code style
      Minor

      Avoid empty catch blocks.

      empty_constructor_bodies

      Code style
      Minor

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

      empty_statements

      Code style
      Minor

      Detect empty statements (dead code)

      EOL_AT_END_OF_FILE

      Code style
      Minor

      Put a single newline at end of file.

      FILE_NAMES

      Code style
      Minor

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

      HASH_AND_EQUALS

      Code style
      Minor

      Override `hashCode` if overriding `==`

      implementation_imports

      Code style
      Minor

      Don't import implementation files from another package.

      IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE

      Code style
      Minor

      Legacy library

      INVALID_ANNOTATION_TARGET

      Code style
      Minor

      Invalid annotation target

      INVALID_NULL_AWARE_OPERATOR

      Code style
      Minor

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

      INVALID_USE_OF_PROTECTED_MEMBER

      Code style
      Minor

      Invalid use of protected members

      INVARIANT_BOOLEANS

      Code style
      Minor

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

      JOIN_RETURN_WITH_ASSIGNMENT

      Code style
      Minor

      Join return statement with assignment when possible.

      LIBRARY_PREFIXES

      Code style
      Minor

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

      MISSING_ENUM_CONSTANT_IN_SWITCH

      Code style
      Minor

      Missing case clause for 'null'.

      MISSING_RETURN

      Code style
      Minor

      Missing return value

      MUST_BE_IMMUTABLE

      Code style
      Minor

      Must be immutable

      MUST_CALL_SUPER

      Code style
      Minor

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

      non_constant_identifier_names

      Code style
      Minor

      Name non-constant identifiers using lowerCamelCase

      NOOP_PRIMITIVE_OPERATIONS

      Code style
      Minor

      Noop primitive operations.

      NULLABLE_TYPE_IN_CATCH_CLAUSE

      Code style
      Minor

      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
      Minor

      Don't override fields.

      OVERRIDE_ON_NON_OVERRIDING_MEMBER

      Code style
      Minor

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

      PREFER_CONST_CONSTRUCTORS

      Code style
      Minor

      Prefer const with constant constructors.

      PREFER_CONST_CONSTRUCTORS_IN_IMMUTABLES

      Code style
      Minor

      Prefer declaring const constructors on `@immutable` classes

      PREFER_CONST_LITERALS_TO_CREATE_IMMUTABLES

      Code style
      Minor

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

      PREFER_FINAL_IN_FOR_EACH

      Code style
      Minor

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

      PREFER_IF_ELEMENTS_TO_CONDITIONAL_EXPRESSIONS

      Code style
      Minor

      Prefer if elements to conditional expressions where possible.

      PREFER_IF_NULL_OPERATORS

      Code style
      Minor

      Prefer using if null operators.

      PREFER_INITIALIZING_FORMALS

      Code style
      Minor

      Use initializing formals when possible.

      PREFER_INTERPOLATION_TO_COMPOSE_STRINGS

      Code style
      Minor

      Use interpolation to compose strings and values.

      PREFER_IS_EMPTY

      Code style
      Minor

      Use isEmpty instead of length\n

      PREFER_IS_NOT_EMPTY

      Code style
      Minor

      Use `isNotEmpty` for Iterables and Maps.

      PREFER_NULL_AWARE_METHOD_CALLS

      Code style
      Minor

      Prefer null aware method calls.

      PREFER_TYPING_UNINITIALIZED_VARIABLES

      Code style
      Minor

      Prefer typing uninitialized variables and fields.

      REQUIRE_TRAILING_COMMAS

      Code style
      Minor

      Missing a required trailing comma.

      SIZED_BOX_FOR_WHITESPACE

      Code style
      Minor

      SizedBox for whitespace.

      SORT_PUB_DEPENDENCIES

      Code style
      Minor

      Sort pub dependencies.

      unnecessary_brace_in_string_interps

      Code style
      Minor

      Avoid using braces in interpolation when not needed.

      UNNECESSARY_CAST

      Code style
      Minor

      Unnecessary cast.

      UNNECESSARY_NEW

      Code style
      Minor

      Unnecessary new keyword.

      UNNECESSARY_NULL_CHECKS

      Code style
      Minor

      Unnecessary null checks

      UNNECESSARY_NULL_COMPARISON

      Code style
      Minor

      The operand can't be null

      UNNECESSARY_PARENTHESIS

      Code style
      Minor

      Unnecessary parenthesis

      unnecessary_statements

      Code style
      Minor

      Avoid using unnecessary statements

      UNNECESSARY_STRING_INTERPOLATIONS

      Code style
      Minor

      Unnecessary string interpolation

      UNUSED_CATCH_CLAUSE

      Code style
      Minor

      Unused catch clause

      UNUSED_CATCH_STACK

      Code style
      Minor

      Stack trace not used

      UNUSED_ELEMENT

      Code style
      Minor

      Unused element

      UNUSED_FIELD

      Code style
      Minor

      Unused fiel

      UNUSED_IMPORT

      Code style
      Minor

      Unused import

      UNUSED_LABEL

      Code style
      Minor

      Unused label

      UNUSED_LOCAL_VARIABLE

      Code style
      Minor

      Unused local variable

      USE_BUILD_CONTEXT_SYNCHRONOUSLY

      Code style
      Minor

      Use build context synchronuously

      USE_LATE_FOR_PRIVATE_FIELDS_AND_VARIABLES

      Code style
      Minor

      Use late for private members with non-nullable type.

      USE_NAMED_CONSTANTS

      Code style
      Minor

      Use named constants

      USE_STRING_BUFFERS

      Code style
      Minor

      Use string buffers to compose strings

      DIRECTIVE_AFTER_DECLARATION

      Code style
      Minor

      Directives must appear before any declarations.

      FLUTTER_STYLE_TODOS

      Code style
      Minor

      Use Flutter TODO format.

      Learn more

      NO_LEADING_UNDERSCORES_FOR_LIBRARY_PREFIXES

      Code style
      Minor

      Avoid leading underscores for library prefixes.

      INVALID_FACTORY_NAME_NOT_A_CLASS

      Code style
      Minor

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