Presets
Presets are cumulative starting points. Each level includes every rule from the levels before it, then adds a clearly defined kind of scrutiny. Choose the lowest tier whose philosophy matches the project and override individual rules when the codebase deliberately makes a different choice.
| Preset | Total rules | Adds | Intended use |
|---|---|---|---|
none |
0 | 0 | Explicit opt-out or a fully hand-picked rule set. |
core |
35 | 35 | Near-certain defects with almost no stylistic judgement. |
recommended |
97 | 62 | The default choice for most production projects. |
opinionated |
184 | 87 | A coherent Many Lints house style. |
pedantic |
241 | 57 | Maximum uniformity, explicitness, ordering, and structural limits. |
none: choose everything yourself
Section titled “none: choose everything yourself”none is the default and enables no rules. It is useful while evaluating the
plugin, for repositories that enable every rule individually, and for a shared
configuration that should provide options without selecting a policy tier.
preset: nonecore: bugs, not taste
Section titled “core: bugs, not taste”Use core when diagnostics must have an exceptionally high signal-to-noise
ratio. It targets contradictory conditions, invalid type relationships,
unreachable behavior, broken lifecycle management, and other code that is very
likely to fail independently of the team’s preferred style.
Rules added by core (35)
Section titled “Rules added by core (35)”- Async safety:
avoid_nested_futures - Bloc / Riverpod:
avoid_duplicate_bloc_event_handlers,emit_new_bloc_state_instances - Code quality:
avoid_equal_expressions,avoid_self_compare,avoid_shadowed_extension_methods - Collections and types:
avoid_collection_equality_checks,avoid_collection_methods_with_unrelated_types,avoid_unrelated_type_casts - Control flow:
avoid_constant_conditions,avoid_constant_switches,avoid_contradictory_expressions,avoid_duplicate_cascades,avoid_unmodified_loop_condition,avoid_unnecessary_negations,prefer_return_await - fpdart:
avoid_bare_await_in_do,avoid_dollar_outside_do_frame,avoid_nested_do_notation,avoid_throw_in_fp_callback,avoid_unrun_task,avoid_untyped_safe_cast - Resource management:
always_remove_listener,avoid_late_final_reassignment,avoid_unassigned_stream_subscriptions,dispose_fields - Riverpod state:
async_value_nullable_pattern,missing_provider_scope,notifier_build - Testing:
avoid_misused_test_matchers,prefer_expect_later - Widget best practices:
always_pass_global_key,avoid_conditional_hooks,avoid_flexible_outside_flex,avoid_recursive_widget_calls
recommended: safe production defaults
Section titled “recommended: safe production defaults”recommended includes core and adds likely defects, concrete runtime risks,
and broadly accepted Dart and Flutter practices. It avoids naming schemes,
architecture mandates, dependency-specific preferences, and choices on which
healthy codebases commonly disagree. This is the best starting point for most
applications and packages.
Rules added by recommended (62)
Section titled “Rules added by recommended (62)”- Async safety:
avoid_future_ignore,avoid_missing_completer_stack_trace,use_setstate_synchronously - Bloc / Riverpod:
avoid_notifier_constructors,avoid_passing_build_context_to_blocs,dispose_provided_instances,handle_bloc_event_subclasses - Code organization:
avoid_duplicate_mixins,avoid_generics_shadowing - Code quality:
avoid_dst_unsafe_date_arithmetic,avoid_exit_outside_entrypoint,function_always_returns_null,function_always_returns_same_value,match_getter_setter_field_names - Collections and types:
avoid_accessing_collections_by_constant_index,avoid_empty_spread,avoid_map_keys_contains,avoid_not_encodable_in_to_json,prefer_any_or_every,prefer_enums_by_name,prefer_iterable_of - Control flow:
avoid_cascade_after_if_null,avoid_collapsible_if,avoid_empty_catch,avoid_inverted_boolean_checks,avoid_only_rethrow,avoid_throw_in_catch_block,no_equal_conditions,no_equal_then_else,prefer_simpler_patterns_null_check,prefer_typed_exceptions,proper_super_calls - fpdart:
avoid_either_of_future,avoid_removed_fpdart_api,prefer_safe_collection_access - Hooks:
avoid_hooks_outside_build,avoid_misused_hooks - Pattern matching:
prefer_wildcard_pattern - Resource management:
avoid_unremovable_callbacks_in_listeners - Riverpod state:
avoid_build_context_in_providers,avoid_ref_inside_state_dispose,avoid_ref_read_inside_build,avoid_ref_watch_outside_build,provider_parameters - State management:
avoid_inherited_widget_in_initstate,avoid_late_context,avoid_mounted_in_setstate,avoid_state_constructors,avoid_unnecessary_setstate - Testing:
avoid_focused_tests,avoid_skipped_tests,prefer_correct_test_file_name - Type annotations:
prefer_explicit_function_type - Widget best practices:
avoid_returning_widgets,avoid_unnecessary_gesture_detector,pass_existing_future_to_future_builder,pass_existing_stream_to_stream_builder,use_closest_build_context,use_dedicated_media_query_methods - Widget replacement:
avoid_expanded_as_spacer,avoid_incorrect_image_opacity,prefer_text_rich
opinionated: one coherent house style
Section titled “opinionated: one coherent house style”opinionated includes recommended and chooses a side where several valid
styles exist. It prefers particular widget shapes, collection expressions,
control-flow forms, shorthand syntax, and type-annotation habits. Adopt it when
consistency is worth occasionally disabling a preference that does not fit the
project.
Rules added by opinionated (87)
Section titled “Rules added by opinionated (87)”- Async safety:
avoid_catch_error,avoid_passing_async_when_sync_expected,avoid_redundant_async,check_is_not_closed_after_async_gap,prefer_correct_future_return_type,require_atomic_async_updates,use_ref_and_state_synchronously,use_ref_read_synchronously - Bloc / Riverpod:
avoid_bloc_public_methods,avoid_passing_bloc_to_bloc,avoid_public_notifier_properties,prefer_bloc_extensions,prefer_immutable_bloc_state,prefer_multi_bloc_provider - Class naming:
avoid_unnecessary_enum_prefix - Code organization:
avoid_unnecessary_constructor,avoid_unnecessary_extends,prefer_abstract_final_static_class,prefer_for_loop_in_children - Code quality:
avoid_commented_out_code,avoid_default_tostring,avoid_non_null_assertion,avoid_todo_comments,avoid_unnecessary_call,prefer_compute_over_isolate_run,prefer_immediate_return,prefer_primary_constructors,prefer_private_named_parameters,prefer_single_setstate - Collections and types:
avoid_incomplete_copy_with,avoid_missing_enum_constant_in_map,avoid_unsafe_collection_methods,prefer_add_all,prefer_correct_edge_insets_constructor,prefer_correct_json_casts,prefer_overriding_parent_equality - Control flow:
avoid_nested_conditional_expressions,avoid_redundant_else,avoid_unnecessary_continue,avoid_unnecessary_return,prefer_returning_condition,prefer_switch_expression - fpdart:
avoid_future_of_either,avoid_future_of_option,prefer_chain_either,prefer_chaining_over_intermediate_run,prefer_do_notation,prefer_from_nullable,prefer_from_predicate,prefer_string_parse_extensions,prefer_task_either_over_try_catch,prefer_unit_over_void - Hooks:
prefer_use_callback - Pattern matching:
avoid_single_field_destructuring,prefer_switch_with_enums,use_existing_destructuring,use_existing_variable - Riverpod state:
protected_notifier_properties - Shorthand patterns:
prefer_returning_shorthands,prefer_shorthands_with_constructors,prefer_shorthands_with_enums,prefer_shorthands_with_static_fields - State management:
avoid_empty_setstate,avoid_unnecessary_overrides,avoid_unnecessary_stateful_widgets,prefer_immutable_state - Testing:
prefer_test_matchers - Type annotations:
prefer_async_callback,prefer_type_over_var,prefer_void_callback - Widget best practices:
avoid_shrink_wrap_in_lists,avoid_single_child_in_multi_child_widgets,avoid_unnecessary_consumer_widgets,avoid_unnecessary_hook_widgets,check_for_equals_in_render_object_setters,prefer_single_widget_per_file,prefer_spacing,prefer_theme_mode_getters - Widget replacement:
avoid_border_all,avoid_wrapping_in_padding,prefer_align_over_container,prefer_center_over_align,prefer_const_border_radius,prefer_constrained_box_over_container,prefer_padding_over_container,prefer_sized_box_square,prefer_transform_over_container
pedantic: uniformity over brevity
Section titled “pedantic: uniformity over brevity”pedantic includes opinionated and treats mechanical consistency as a goal
in its own right. It adds strict naming, one-declaration-per-file organization,
file/type matching, constructor-first member order, alphabetical parameter and
field order, complexity budgets, explicit callback parameter names, and a full
ban on postfix ! including map[key]!.
Use it for codebases that want one predictable shape everywhere and accept
configuration work during adoption. Because a plugin cannot activate Dart SDK
lints, combine it with SDK rules such as always_specify_types,
directives_ordering, and public_member_api_docs for the full strict
style. Avoid pairing member_ordering with sort_constructors_first: their
constructor-first checks overlap.
Rules added by pedantic (57)
Section titled “Rules added by pedantic (57)”- Class naming:
prefer_boolean_prefixes,prefer_correct_callback_field_name,prefer_correct_error_name,prefer_correct_handler_name,prefer_correct_identifier_length,prefer_correct_setter_parameter_name,prefer_correct_type_name - Code organization:
arguments_ordering,enum_constants_ordering,initializers_ordering,map_keys_ordering,match_lib_folder_structure,member_ordering,parameters_ordering,pattern_fields_ordering,prefer_match_file_name,prefer_single_declaration_per_file,record_fields_ordering - Code quality:
avoid_accessing_other_classes_private_members,avoid_complex_conditions,avoid_deep_nesting,avoid_high_cyclomatic_complexity,avoid_long_files,avoid_long_functions,avoid_long_parameter_list,avoid_too_many_methods,max_imports,max_statements,no_magic_number,no_magic_string,prefer_declaring_const_constructor,prefer_getter_over_method,prefer_moving_to_variable,prefer_named_parameters - Collections and types:
avoid_duplicate_collection_elements,prefer_class_destructuring - Control flow:
avoid_negated_conditions,avoid_unused_after_null_check,no_equal_switch_case,prefer_conditional_expressions,prefer_early_return - Formatting:
avoid_inconsistent_digit_separators,double_literal_format,format_comment - fpdart:
avoid_get_or_else_swallowing_failure,avoid_unnecessary_option - Hooks:
prefer_use_prefix - Pattern matching:
avoid_wildcard_cases_with_enums - Shorthand patterns:
avoid_nested_shorthands - Type annotations:
prefer_explicit_parameter_names,prefer_typedefs_for_callbacks - Widget best practices:
avoid_deep_widget_nesting,avoid_too_many_widgets_per_build,never_discard_build_context,prefer_extracting_callbacks,prefer_widget_private_members,use_sliver_prefix
Rules outside every preset (18)
Section titled “Rules outside every preset (18)”Some rules need project-specific vocabulary, assume an optional dependency,
enforce the opposite of a convention selected by opinionated, or are
deliberately opt-in conventions. They remain available by name so presets never
guess package dependencies, silently do nothing without required options,
overreach into project-specific taste, or enable fixes that undo one another.
- Architecture:
avoid_banned_annotations,avoid_banned_exports,avoid_banned_imports,avoid_banned_names,avoid_banned_types,banned_usage - Class naming:
match_class_name_pattern,prefer_prefixed_global_constants,use_class_prefix,use_class_suffix - Collections and types:
list_all_equatable_fields - fpdart:
avoid_ad_hoc_left_type - Testing:
format_test_name,require_mirror_test - Type annotations:
prefer_equatable_mixin,prefer_explicit_type_arguments - Widget best practices:
use_gap - Widget replacement:
prefer_container
Moving between presets
Section titled “Moving between presets”Moving upward only adds rules: core ⊂ recommended ⊂ opinionated ⊂ pedantic.
An explicit per-rule enabled: value always wins, so a project can adopt a
tier and document its few intentional exceptions:
preset: pedanticrules: avoid_long_functions: max_lines: 80 prefer_spacing: enabled: false use_gap: enabled: trueSee Configuration for option precedence, per-rule exclusions, diagnostic severity, and both supported config locations.