Lint set contents

Core lint rules

Lint RulesDescriptionFix
avoid_empty_elseAvoid empty statements in else clauses.✅
avoid_relative_lib_importsAvoid relative imports for files in lib/.✅
avoid_shadowing_type_parametersAvoid shadowing type parameters.
avoid_types_as_parameter_namesAvoid types as parameter names.
await_only_futuresAwait only futures.✅
camel_case_extensionsName extensions using UpperCamelCase.
camel_case_typesName types using UpperCamelCase.
collection_methods_unrelated_typeInvocation of various collection methods with arguments of unrelated types.
curly_braces_in_flow_control_structuresDO use curly braces for all flow control structures.✅
dangling_library_doc_commentsAttach library doc comments to library directives.✅
depend_on_referenced_packagesDepend on referenced packages.
empty_catchesAvoid empty catch blocks.✅
file_namesName source files using lowercase_with_underscores.
hash_and_equalsAlways override hashCode if overriding ==.✅
implicit_call_tearoffsExplicitly tear-off call methods when using an object as a Function.✅
invalid_runtime_check_with_js_interop_typesAvoid runtime type tests with JS interop types where the result may not be platform-consistent.
library_annotationsAttach library annotations to library directives.✅
no_duplicate_case_valuesDon't use more than one case with same value.✅
no_wildcard_variable_usesDon't use wildcard parameters or variables.
non_constant_identifier_namesName non-constant identifiers using lowerCamelCase.✅
null_check_on_nullable_type_parameterDon't use null check on a potentially nullable type parameter.✅
prefer_generic_function_type_aliasesPrefer generic function type aliases.✅
prefer_is_emptyUse isEmpty for Iterables and Maps.✅
prefer_is_not_emptyUse isNotEmpty for Iterables and Maps.✅
prefer_iterable_whereTypePrefer to use whereType on iterable.✅
prefer_typing_uninitialized_variablesPrefer typing uninitialized variables and fields.✅
provide_deprecation_messageProvide a deprecation message, via @Deprecated("message").
secure_pubspec_urlsUse secure urls in pubspec.yaml.
strict_top_level_inferenceSpecify type annotations.✅
switch_on_typeAvoid switch statements on a ‘Type’.
type_literal_in_constant_patternDon't use constant patterns with type literals.✅
unintended_html_in_doc_commentUse of angle brackets in a doc comment is treated as HTML by Markdown.
unnecessary_overridesDon't override a method to do a super method invocation with the same parameters.✅
unrelated_type_equality_checksEquality operator == invocation with references of unrelated types.✅
use_string_in_part_of_directivesUse string in part of directives.✅
valid_regexpsUse valid regular expression syntax.
void_checksDon't assign to void.

Recommended lint rules

Lint RulesDescriptionFix
annotate_overridesAnnotate overridden members.✅
avoid_function_literals_in_foreach_callsAvoid using forEach with a function literal.✅
avoid_init_to_nullDon't explicitly initialize variables to null.✅
avoid_renaming_method_parametersDon't rename parameters of overridden methods.✅
avoid_return_types_on_settersAvoid return types on setters.✅
avoid_returning_null_for_voidAvoid returning null for void.✅
avoid_single_cascade_in_expression_statementsAvoid single cascade in expression statements.✅
constant_identifier_namesPrefer using lowerCamelCase for constant names.✅
control_flow_in_finallyAvoid control flow in finally blocks.
empty_constructor_bodiesUse ; instead of {} for empty constructor bodies.✅
empty_statementsAvoid empty statements.✅
exhaustive_casesDefine case clauses for all constants in enum-like types.✅
implementation_importsDon't import implementation files from another package.
library_prefixesUse lowercase_with_underscores when specifying a library prefix.
library_private_types_in_public_apiAvoid using private types in public APIs.
no_leading_underscores_for_library_prefixesAvoid leading underscores for library prefixes.✅
no_leading_underscores_for_local_identifiersAvoid leading underscores for local identifiers.✅
null_closuresDo not pass null as an argument where a closure is expected.✅
overridden_fieldsDon't override fields.
package_namesUse lowercase_with_underscores for package names.
prefer_adjacent_string_concatenationUse adjacent strings to concatenate string literals.✅
prefer_collection_literalsUse collection literals when possible.✅
prefer_conditional_assignmentPrefer using ??= over testing for null.✅
prefer_containsUse contains for List and String instances.✅
prefer_final_fieldsPrivate field could be final.✅
prefer_for_elements_to_map_fromIterablePrefer for elements when building maps from iterables.✅
prefer_function_declarations_over_variablesUse a function declaration to bind a function to a name.✅
prefer_if_null_operatorsPrefer using ?? operators.✅
prefer_initializing_formalsUse initializing formals when possible.✅
prefer_inlined_addsInline list item declarations where possible.✅
prefer_interpolation_to_compose_stringsUse interpolation to compose strings and values.✅
prefer_is_not_operatorPrefer is! operator.✅
prefer_null_aware_operatorsPrefer using null-aware operators.✅
prefer_spread_collectionsUse spread collections when possible.✅
recursive_gettersProperty getter recursively returns itself.
simple_directive_pathsUse simple directive paths.✅
simplify_variable_patternAvoid unnecessary member names in variable patterns.✅
slash_for_doc_commentsPrefer using /// for doc comments.✅
type_init_formalsDon't type annotate initializing formals.✅
unnecessary_brace_in_string_interpsAvoid using braces in interpolation when not needed.✅
unnecessary_constAvoid const keyword.✅
unnecessary_constructor_nameUnnecessary .new constructor name.✅
unnecessary_getters_settersAvoid wrapping fields in getters and setters just to be “safe”.✅
unnecessary_lateDon't specify the late modifier when it is not needed.✅
unnecessary_library_nameDon't have a library name in a library declaration.✅
unnecessary_newUnnecessary new keyword.✅
unnecessary_null_aware_assignmentsAvoid null in null-aware assignment.✅
unnecessary_null_in_if_null_operatorsAvoid using null in ?? operators.✅
unnecessary_nullable_for_final_variable_declarationsUse a non-nullable type for a final variable initialized with a non-nullable value.✅
unnecessary_string_escapesRemove unnecessary backslashes in strings.✅
unnecessary_string_interpolationsUnnecessary string interpolation.✅
unnecessary_thisDon't access members with this unless avoiding shadowing.✅
unnecessary_to_list_in_spreadsUnnecessary toList() in spreads.✅
unnecessary_unawaitedUnnecessary use of ‘unawaited’.✅
unnecessary_underscoresUnnecessary underscores can be removed.✅
use_function_type_syntax_for_parametersUse generic function type syntax for parameters.✅
use_null_aware_elementsIf-elements testing for null can be replaced with null-aware elements.✅
use_rethrow_when_possibleUse rethrow to rethrow a caught exception.✅
use_super_parametersUse super-initializer parameters where possible.✅