1+ # include: package:flutter_lints/flutter.yaml
2+ include : package:very_good_analysis/analysis_options.yaml
3+
4+ analyzer :
5+ errors :
6+ avoid_dynamic_calls : error
7+ missing_required_param : error
8+ missing_return : error
9+ # allow having TODOs in the code
10+ todo : info
11+ missing_enum_constant_in_switch : error
12+ implicit_dynamic_type : info
13+ implicit_dynamic_map_literal : info
14+ implicit_dynamic_list_literal : info
15+ implicit_dynamic_method : warning
16+ implicit_dynamic_function : warning
17+ invalid_use_of_protected_member : error
18+ unused_local_variable : warning
19+ deprecated_member_use : warning
20+ unused_element : warning
21+ unused_field : warning
22+ dead_code : error
23+ must_call_super : error
24+
25+ # linter errors
26+ unnecessary_statements : error
27+ recursive_getters : error
28+ unnecessary_new : error
29+ unnecessary_getters_setters : error
30+ use_function_type_syntax_for_parameters : error
31+ no_duplicate_case_values : error
32+ no_adjacent_strings_in_list : error
33+ non_constant_identifier_names : error
34+ constant_identifier_names : error
35+ avoid_returning_this : error
36+ prefer_const_constructors_in_immutables : error
37+ prefer_const_literals_to_create_immutables : error
38+ avoid_equals_and_hash_code_on_mutable_classes : error
39+ camel_case_types : error
40+ camel_case_extensions : error
41+ library_names : error
42+ file_names : error
43+ library_prefixes : error
44+
45+ # linter warnings
46+ avoid_print : warning
47+ unnecessary_lambdas : warning
48+ use_key_in_widget_constructors : warning
49+ prefer_final_fields : warning
50+ prefer_final_locals : warning
51+ prefer_final_in_for_each : warning
52+ prefer_const_constructors : warning
53+ unnecessary_const : warning
54+ unnecessary_brace_in_string_interps : warning
55+
56+ # Ignore analyzer hints for updating pubspecs when using Future or
57+ # Stream and not importing dart:async
58+ # Please see https://github.com/flutter/flutter/pull/24528 for details.
59+ sdk_version_async_exported_from_core : ignore
60+ exclude :
61+ - " bin/cache/**"
62+ - " **/*.chopper.dart"
63+ - " **/generated/**"
64+ - " **/*.g.dart"
65+ language :
66+ strict-casts : true
67+ strict-raw-types : true
68+
69+ linter :
70+ rules :
71+ # these rules are documented on and in the same order as
72+ # the Dart Lint rules page to make maintenance easier
73+ # https://github.com/dart-lang/linter/blob/master/example/all.yaml
74+ - always_declare_return_types
75+ # always_put_control_body_on_new_line
76+ # always_put_required_named_parameters_first
77+ - always_require_non_null_named_parameters
78+ - avoid_dynamic_calls
79+ # - always_specify_types
80+ - annotate_overrides
81+ - avoid_print
82+ # - avoid_annotating_with_dynamic # conflicts with always_specify_types
83+ - avoid_returning_this
84+ - avoid_init_to_null
85+ - avoid_bool_literals_in_conditional_expressions
86+ # - avoid_catches_without_on_clauses # we do this commonly
87+ # - avoid_catching_errors # we do this commonly
88+ # - avoid_classes_with_only_static_members
89+ # - avoid_double_and_int_checks # only useful when targeting JS runtime
90+ - avoid_empty_else
91+ - avoid_field_initializers_in_const_classes
92+ - avoid_function_literals_in_foreach_calls
93+ # - avoid_js_rounded_ints # only useful when targeting JS runtime
94+ - avoid_null_checks_in_equality_operators
95+ # - avoid_positional_boolean_parameters
96+ # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
97+ - avoid_relative_lib_imports
98+ - avoid_renaming_method_parameters
99+ - avoid_return_types_on_setters
100+ # - avoid_returning_null # there are plenty of valid reasons to return null
101+ # - avoid_returning_null_for_future # not yet tested
102+ - avoid_returning_null_for_void
103+ # - avoid_returning_this # there are plenty of valid reasons to return this
104+ # - avoid_setters_without_getters # not yet tested
105+ # - avoid_shadowing_type_parameters # not yet tested
106+ # - avoid_single_cascade_in_expression_statements # not yet tested
107+ - avoid_slow_async_io
108+ - avoid_types_as_parameter_names
109+ # - avoid_types_on_closure_parameters # conflicts with always_specify_types
110+ - avoid_unused_constructor_parameters
111+ - avoid_void_async
112+ - await_only_futures
113+ - camel_case_types
114+ - cancel_subscriptions
115+ # - cascade_invocations # not yet tested
116+ # - close_sinks # not reliable enough
117+ # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
118+ # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
119+ - control_flow_in_finally
120+ # - curly_braces_in_flow_control_structures # not yet tested
121+ # - diagnostic_describe_all_properties # not yet tested
122+ - directives_ordering
123+ - empty_catches
124+ - empty_constructor_bodies
125+ - empty_statements
126+ # - file_names # not yet tested
127+ - hash_and_equals
128+ - implementation_imports
129+ # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
130+ - iterable_contains_unrelated_type
131+ # - join_return_with_assignment # not yet tested
132+ - library_names
133+ - library_prefixes
134+ # - lines_longer_than_80_chars # not yet tested
135+ - list_remove_unrelated_type
136+ # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
137+ - no_adjacent_strings_in_list
138+ - no_duplicate_case_values
139+ - non_constant_identifier_names
140+ # - null_closures # not yet tested
141+ # - omit_local_variable_types # opposite of always_specify_types
142+ # - one_member_abstracts # too many false positives
143+ # - only_throw_errors # https://github.com/flutter/flutter/issues/5792
144+ - overridden_fields
145+ - package_api_docs
146+ - package_names
147+ - package_prefixed_library_names
148+ # - parameter_assignments # we do this commonly
149+ - prefer_adjacent_string_concatenation
150+ - prefer_asserts_in_initializer_lists
151+ # - prefer_asserts_with_message # not yet tested
152+ - prefer_collection_literals
153+ - prefer_conditional_assignment
154+ - prefer_const_constructors
155+ - prefer_const_constructors_in_immutables
156+ - prefer_const_declarations
157+ - prefer_const_literals_to_create_immutables
158+ # - prefer_constructors_over_static_methods # not yet tested
159+ - prefer_contains
160+ # - prefer_double_quotes # opposite of prefer_single_quotes
161+ - prefer_equal_for_default_values
162+ # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
163+ - prefer_final_fields
164+ # - prefer_final_in_for_each # not yet tested
165+ - prefer_final_locals
166+ # - prefer_for_elements_to_map_fromIterable # not yet tested
167+ - prefer_foreach
168+ # - prefer_function_declarations_over_variables # not yet tested
169+ - prefer_generic_function_type_aliases
170+ # - prefer_if_elements_to_conditional_expressions # not yet tested
171+ - prefer_if_null_operators
172+ - prefer_initializing_formals
173+ - prefer_inlined_adds
174+ # - prefer_int_literals # not yet tested
175+ # - prefer_interpolation_to_compose_strings # not yet tested
176+ - prefer_is_empty
177+ - prefer_is_not_empty
178+ - prefer_iterable_whereType
179+ # - prefer_mixin # https://github.com/dart-lang/language/issues/32
180+ # - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
181+ - prefer_single_quotes
182+ - prefer_spread_collections
183+ - prefer_typing_uninitialized_variables
184+ - prefer_void_to_null
185+ # - provide_deprecation_message # not yet tested
186+ # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
187+ - recursive_getters
188+ - slash_for_doc_comments
189+ # - sort_child_properties_last # not yet tested
190+ # - sort_constructors_first
191+ - sort_pub_dependencies
192+ - sort_unnamed_constructors_first
193+ - test_types_in_equals
194+ - throw_in_finally
195+ # - type_annotate_public_apis # subset of always_specify_types
196+ - type_init_formals
197+ - unawaited_futures
198+ # - unnecessary_await_in_return # not yet tested
199+ - unnecessary_brace_in_string_interps
200+ - unnecessary_const
201+ - unnecessary_getters_setters
202+ # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
203+ - unnecessary_new
204+ - unnecessary_null_aware_assignments
205+ - unnecessary_null_in_if_null_operators
206+ - unnecessary_overrides
207+ - unnecessary_parenthesis
208+ - unnecessary_statements
209+ - unnecessary_this
210+ - unrelated_type_equality_checks
211+ # - unsafe_html # not yet tested
212+ - use_full_hex_values_for_flutter_colors
213+ # - use_function_type_syntax_for_parameters # not yet tested
214+ - use_rethrow_when_possible
215+ - use_key_in_widget_constructors
216+ # - use_setters_to_change_properties # not yet tested
217+ # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
218+ # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
219+ - valid_regexps
220+ # - void_checks # not yet tested
0 commit comments