Dart lints, page 2 of 2
The lint rules of Dart, with what each one finds. This page has 264 cards.
Try removing the 'async' modifier. Its category is style. It is experimental since Dart 3.7.
- Code
unnecessary_async- Message
Don't make a function 'async' if it doesn't use 'await'.
Try removing the 'await'. Its category is style. It is stable since Dart 2.1. The Dart team deprecated it in Dart 3.13.
- Code
unnecessary_await_in_return- Message
Unnecessary 'await'.
Try removing the braces. Its category is brevity, style. It is stable since Dart 2.0.
- Code
unnecessary_brace_in_string_interps- Message
Unnecessary braces in a string interpolation.
Try removing the 'break'. Its category is brevity, style. It is stable since Dart 3.0.
- Code
unnecessary_breaks- Message
Unnecessary 'break' statement.
Try removing the keyword. Its category is brevity, style. It is stable since Dart 2.0.
- Code
unnecessary_const- Message
Unnecessary 'const' keyword.
Try removing the keyword. Its category is brevity, style. It is stable since Dart 3.13.
- Code
unnecessary_const_in_enum_constructor- Message
Unnecessary 'const' keyword in an enum constructor.
Try removing the '.new'. Its category is brevity, style. It is stable since Dart 2.15.
- Code
unnecessary_constructor_name- Message
Unnecessary '.new' constructor name.
Try removing the getter and setter and renaming the field. Its category is effectiveDart, style. It is stable since Dart 2.0.
- Code
unnecessary_getters_setters- Message
Unnecessary use of getter and setter to wrap a field.
Try removing the ignore comment. Its category is style. It is experimental since Dart 3.8.
- Code
unnecessary_ignore- Message
The diagnostic '{}' isn't produced at this location so it doesn't need to be ignored.- Message
The diagnostic '{}' isn't produced in this file so it doesn't need to be ignored.
Try using a tearoff rather than a closure. Its category is style. It is stable since Dart 2.0.
- Code
unnecessary_lambdas- Message
Closure should be a tearoff.
Try removing the 'late'. Its category is style. It is stable since Dart 2.16.
- Code
unnecessary_late- Message
Unnecessary 'late' modifier.
Try deleting the library directive. Its category is brevity. It is stable since Dart 2.19.
- Code
unnecessary_library_directive- Message
Library directives without comments or annotations should be avoided.
Remove the library name. Its category is brevity, languageFeatureUsage, style. It is stable since Dart 3.4.
- Code
unnecessary_library_name- Message
Library names are not necessary.
Try removing the 'new' keyword. Its category is brevity, languageFeatureUsage, style. It is stable since Dart 2.0.
- Code
unnecessary_new- Message
Unnecessary 'new' keyword.
Try removing the assignment. Its category is brevity, effectiveDart, style. It is stable since Dart 2.0.
- Code
unnecessary_null_aware_assignments- Message
Unnecessary assignment of 'null'.
Try removing the '?'. Its category is style. It is stable since Dart 2.18.
- Code
unnecessary_null_aware_operator_on_extension_on_nullable- Message
Unnecessary use of a null-aware operator to invoke an extension method on a nullable type.
Try removing the null check. Its category is brevity, style. It is stable since Dart 3.13.
- Code
unnecessary_null_checks- Message
Unnecessary use of a null check ('!').
Try removing the '??' operator and the 'null' operand. Its category is style. It is stable since Dart 2.0.
- Code
unnecessary_null_in_if_null_operators- Message
Unnecessary use of '??' with 'null'.
Try changing the type to be non-nullable. Its category is style. It is stable since Dart 2.10.
- Code
unnecessary_nullable_for_final_variable_declarations- Message
Type could be non-nullable.
Try adding behavior in the overriding member or removing the override. Its category is style. It is stable since Dart 2.0.
- Code
unnecessary_overrides- Message
Unnecessary override.
Try removing the parentheses. Its category is brevity, style. It is stable since Dart 2.0.
- Code
unnecessary_parenthesis- Message
Unnecessary use of parentheses.
Try removing the body. Its category is brevity, style. It is stable since Dart 3.13.
- Code
unnecessary_primary_constructor_body- Message
Unnecessary primary constructor body.
Try using a normal string. Its category is brevity, style. It is stable since Dart 2.8.
- Code
unnecessary_raw_strings- Message
Unnecessary use of a raw string.
Try completing the statement or breaking it up. Its category is brevity, unintentional. It is stable since Dart 2.0.
- Code
unnecessary_statements- Message
Unnecessary statement.
Remove the '\' escape. Its category is brevity, style. It is stable since Dart 2.8.
- Code
unnecessary_string_escapes- Message
Unnecessary escape in string literal.
Try replacing the string literal with the variable name. Its category is brevity, style. It is stable since Dart 2.8.
- Code
unnecessary_string_interpolations- Message
Unnecessary use of string interpolation.
Try removing 'this.'. Its category is brevity, effectiveDart, style. It is stable since Dart 2.0.
- Code
unnecessary_this- Message
Unnecessary 'this.' qualifier.
Try removing the variable and using 'this' directly. Its category is style. It is experimental since Dart 3.14.
- Code
unnecessary_this_alias- Message
Unnecessary 'this' alias.
Try removing the invocation of 'toList'. Its category is brevity. It is stable since Dart 2.18.
- Code
unnecessary_to_list_in_spreads- Message
Unnecessary use of 'toList' in a spread.
Try removing the type name. Its category is brevity, style. It is stable since Dart 3.13.
- Code
unnecessary_type_name_in_constructor- Message
Unnecessary type name in a constructor.
Try removing the use of 'unawaited', as the unawaited element is annotated with '@awaitNotRequired'. Its category is brevity, unintentional, unusedCode. It is stable since Dart 3.9.
- Code
unnecessary_unawaited- Message
Unnecessary use of 'unawaited'.
Try using '_'. Its category is brevity, style. It is experimental since Dart 3.7.
- Code
unnecessary_underscores- Message
Unnecessary use of multiple underscores.
Try referencing the member or removing it. Its category is unusedCode. It is stable since Dart 2.19.
- Code
unreachable_from_main- Message
Unreachable member '{}' in an executable library.
Try changing one or both of the operands. Its category is unintentional. It is stable since Dart 2.0.
- Code
unrelated_type_equality_checks- Message
The type of the right operand ('{}') isn't a subtype or a supertype of the left operand ('{}').- Message
The type of the operand ('{}') isn't a subtype or a supertype of the value being matched ('{}').
Try finding a different way to implement the page.
- Code
unsafe_html- Message
Invoking the constructor '{}' is unsafe.- Message
Invoking the method '{}' is unsafe.
Try using a more general type that doesn't contain any type parameters in such a position. Its category is errorProne. It is experimental since Dart 3.7.
- Code
unsafe_variance- Message
This type is unsafe: a type parameter occurs in a non-covariant position.
Try rewriting the code to not use the 'BuildContext', or guard the use with a 'mounted' check. Its category is errorProne, flutter. It is stable since Dart 3.2.
- Code
use_build_context_synchronously- Message
Don't use 'BuildContext's across async gaps.- Message
Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check.
Try replacing the 'Container' with a 'ColoredBox'. Its category is flutter, style. It is stable since Dart 2.17.
- Code
use_colored_box- Message
Use a 'ColoredBox' rather than a 'Container' with only a 'Color'.
Try using a declaring parameter. Its category is style. It is stable since Dart 3.13.
- Code
use_declaring_parameters- Message
Use a declaring parameter.
Try replacing the 'Container' with a 'DecoratedBox'. Its category is flutter, style. It is stable since Dart 2.16.
- Code
use_decorated_box- Message
Use 'DecoratedBox' rather than a 'Container' with only a 'Decoration'.
Try using an enum rather than a class. Its category is style. It is stable since Dart 2.17.
- Code
use_enums- Message
Class should be an enum.
Its category is flutter, style. It is stable since Dart 2.2.
- Code
use_full_hex_values_for_flutter_colors- Message
Instances of 'Color' should be created using an 8-digit hexadecimal integer (such as '0xFFFFFFFF').
Try using the generic function type syntax. Its category is style. It is stable since Dart 2.1.
- Code
use_function_type_syntax_for_parameters- Message
Use the generic function type syntax to declare the parameter '{}'.
Try using an if-null operator. Its category is effectiveDart, style. It is stable since Dart 2.13. The Dart team deprecated it in Dart 3.11.
- Code
use_if_null_to_convert_nulls_to_bools- Message
Use an if-null operator to convert a 'null' to a 'bool'.
Try using '…'. Its category is style. It is stable since Dart 2.9.
- Code
use_is_even_rather_than_modulo- Message
Use '{}' rather than '% 2'.
Try adding a named parameter to the constructor. Its category is flutter, style. It is stable since Dart 2.8.
- Code
use_key_in_widget_constructors- Message
Constructors for public widgets should have a named 'key' parameter.
Try adding the 'late' modifier. Its category is style. It is experimental since Dart 2.10.
- Code
use_late_for_private_fields_and_variables- Message
Use 'late' for private members with a non-nullable type.
Try using '…'. Its category is style. It is stable since Dart 2.13.
- Code
use_named_constants- Message
Use the constant '{}' rather than a constructor returning the same object.
Try using '?'. Its category is brevity, style. It is stable since Dart 3.8.
- Code
use_null_aware_elements- Message
Use the null-aware marker '?' rather than a null check via an 'if'.
Try using a primary constructor. Its category is style.
- Code
use_primary_constructors- Message
Use a primary constructor.
Try making the string a raw string and removing the escapes. Its category is style. It is stable since Dart 2.8.
- Code
use_raw_strings- Message
Use a raw string to avoid using escapes.
Try replacing the 'throw' with a 'rethrow'. Its category is brevity, effectiveDart. It is stable since Dart 2.0.
- Code
use_rethrow_when_possible- Message
Use 'rethrow' to rethrow a caught exception.
Try converting the method to a setter. Its category is style. It is stable since Dart 2.0.
- Code
use_setters_to_change_properties- Message
The method is used to change a property.
Try writing the parts of a string to a string buffer. Its category is nonPerformant. It is stable since Dart 2.0.
- Code
use_string_buffers- Message
Use a string buffer rather than '+' to compose strings.
Try converting the directive to use the URI of the library. Its category is effectiveDart, style. It is stable since Dart 2.19.
- Code
use_string_in_part_of_directives- Message
The part-of directive uses a library name.
Try converting … to super parameters. Its category is brevity. It is experimental since Dart 2.17.
- Code
use_super_parameters- Message
Parameters {} could be super parameters.- Message
Parameter '{}' could be a super parameter.
Try removing the try-catch and using 'throwsA' to expect an exception. Its category is style. It is stable since Dart 2.14.
- Code
use_test_throws_matchers- Message
Use the 'throwsA' matcher instead of using 'fail' when there is no exception thrown.
Try renaming the method to use either 'to' or 'as'. Its category is effectiveDart, style. It is stable since Dart 2.0.
- Code
use_to_and_as_if_applicable- Message
Start the name of the method with 'to' or 'as'.
Try using truncating division, '~/', instead of regular division ('/') followed by 'toInt()'. Its category is languageFeatureUsage. It is stable since Dart 3.6.
- Code
use_truncating_division- Message
Use truncating division.
Try correcting the regular expression. Its category is unintentional. It is stable since Dart 2.0.
- Code
valid_regexps- Message
Invalid regular expression syntax.
Try removing the keyword 'var' or replacing `var` with a type annotation. Its category is languageFeatureUsage. It is experimental since Dart 3.12.
- Code
var_with_no_type_annotation- Message
Avoid declaring parameters with `var` and no type annotation.
Try declaring a 'visit' method for all registered node types. Its category is errorProne. It is internal since Dart 3.10.
- Code
visit_registered_nodes- Message
Declare 'visit' methods for all registered node types.
Try removing the assignment or changing the type of the variable. Its category is style. It is stable since Dart 2.0.
- Code
void_checks- Message
Assignment to a variable of type 'void'.