Skip to content

Commit 583b019

Browse files
author
M-Ahal
committed
Ran dart fix --apply
1 parent 9913bef commit 583b019

24 files changed

Lines changed: 395 additions & 97 deletions

analysis_options.yaml

Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
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+
invalid_use_of_protected_member: error
13+
unused_local_variable: warning
14+
deprecated_member_use: warning
15+
unused_element: warning
16+
unused_field: warning
17+
dead_code: error
18+
must_call_super: error
19+
20+
# linter errors
21+
unnecessary_statements: error
22+
recursive_getters: error
23+
unnecessary_new: error
24+
unnecessary_getters_setters: error
25+
use_function_type_syntax_for_parameters: error
26+
no_duplicate_case_values: error
27+
no_adjacent_strings_in_list: error
28+
non_constant_identifier_names: error
29+
constant_identifier_names: error
30+
avoid_returning_this: error
31+
prefer_const_constructors_in_immutables: error
32+
prefer_const_literals_to_create_immutables: error
33+
avoid_equals_and_hash_code_on_mutable_classes: error
34+
camel_case_types: error
35+
camel_case_extensions: error
36+
library_names: error
37+
file_names: error
38+
library_prefixes: error
39+
invalid_use_of_visible_for_testing_member: error
40+
invalid_use_of_visible_for_overriding_member: error
41+
42+
43+
# linter warnings
44+
annotate_overrides: warning
45+
avoid_print: warning
46+
unnecessary_lambdas: warning
47+
use_key_in_widget_constructors: warning
48+
prefer_final_fields: warning
49+
prefer_final_locals: warning
50+
prefer_final_in_for_each: warning
51+
prefer_const_constructors: warning
52+
unnecessary_const: warning
53+
unnecessary_brace_in_string_interps: warning
54+
invalid_visibility_annotation: warning
55+
56+
# linter ignores
57+
lines_longer_than_80_chars: ignore
58+
always_use_package_imports: ignore
59+
avoid_setters_without_getters: ignore
60+
sort_constructors_first: ignore
61+
public_member_api_docs: ignore
62+
require_trailing_commas: ignore
63+
type_annotate_public_apis: ignore
64+
65+
exclude:
66+
- "bin/cache/**"
67+
- "**/*.chopper.dart"
68+
- "**/generated/**"
69+
- "**/*.g.dart"
70+
language:
71+
strict-casts: true
72+
strict-raw-types: true
73+
74+
linter:
75+
rules:
76+
always_declare_return_types: true
77+
always_put_control_body_on_new_line: false # Opinionated: trade-off for conciseness is acceptable here
78+
always_put_required_named_parameters_first: true
79+
always_specify_types: false # Conflicts with avoid_types_on_closure_parameters
80+
always_use_package_imports: false # Conflicts with prefer_relative_imports
81+
annotate_overrides: true
82+
annotate_redeclares: true
83+
avoid_annotating_with_dynamic: true
84+
avoid_bool_literals_in_conditional_expressions: true
85+
avoid_catches_without_on_clauses: true
86+
avoid_catching_errors: true
87+
avoid_classes_with_only_static_members: false # We do this a lot
88+
avoid_double_and_int_checks: true
89+
avoid_dynamic_calls: true
90+
avoid_empty_else: true
91+
avoid_equals_and_hash_code_on_mutable_classes: true
92+
avoid_escaping_inner_quotes: true
93+
avoid_field_initializers_in_const_classes: true
94+
avoid_final_parameters: true
95+
avoid_function_literals_in_foreach_calls: true
96+
avoid_futureor_void: true
97+
avoid_implementing_value_types: true
98+
avoid_init_to_null: true
99+
avoid_js_rounded_ints: true
100+
avoid_multiple_declarations_per_line: true
101+
avoid_null_checks_in_equality_operators: true
102+
avoid_positional_boolean_parameters: true
103+
avoid_print: true
104+
avoid_private_typedef_functions: true
105+
avoid_redundant_argument_values: true
106+
avoid_relative_lib_imports: true
107+
avoid_renaming_method_parameters: true
108+
avoid_return_types_on_setters: true
109+
avoid_returning_null_for_void: true
110+
avoid_returning_this: true
111+
avoid_setters_without_getters: true
112+
avoid_shadowing_type_parameters: true
113+
avoid_single_cascade_in_expression_statements: true
114+
avoid_slow_async_io: true
115+
avoid_type_to_string: true
116+
avoid_types_as_parameter_names: true
117+
avoid_types_on_closure_parameters: true
118+
avoid_unnecessary_containers: true
119+
avoid_unused_constructor_parameters: true
120+
avoid_void_async: true
121+
avoid_web_libraries_in_flutter: true
122+
await_only_futures: true
123+
camel_case_extensions: true
124+
camel_case_types: true
125+
cancel_subscriptions: true
126+
cascade_invocations: true
127+
cast_nullable_to_non_nullable: true
128+
close_sinks: true
129+
collection_methods_unrelated_type: true
130+
combinators_ordering: true
131+
comment_references: true
132+
conditional_uri_does_not_exist: true
133+
constant_identifier_names: true
134+
control_flow_in_finally: true
135+
curly_braces_in_flow_control_structures: true
136+
dangling_library_doc_comments: true
137+
depend_on_referenced_packages: true
138+
deprecated_consistency: true
139+
deprecated_member_use_from_same_package: true
140+
diagnostic_describe_all_properties: false # Opinionated: a bit much for now. Better used at a package-level
141+
directives_ordering: true
142+
discarded_futures: false
143+
do_not_use_environment: true
144+
document_ignores: true
145+
empty_catches: true
146+
empty_constructor_bodies: true
147+
empty_statements: true
148+
eol_at_end_of_file: true
149+
exhaustive_cases: true
150+
file_names: true
151+
flutter_style_todos: true
152+
hash_and_equals: true
153+
implementation_imports: true
154+
implicit_call_tearoffs: true
155+
implicit_reopen: true
156+
invalid_case_patterns: true
157+
invalid_runtime_check_with_js_interop_types: true
158+
join_return_with_assignment: true
159+
leading_newlines_in_multiline_strings: true
160+
library_annotations: true
161+
library_names: true
162+
library_prefixes: true
163+
library_private_types_in_public_api: true
164+
lines_longer_than_80_chars: true
165+
literal_only_boolean_expressions: true
166+
matching_super_parameters: true
167+
missing_code_block_language_in_doc_comment: true
168+
missing_whitespace_between_adjacent_strings: true
169+
no_adjacent_strings_in_list: true
170+
no_default_cases: true
171+
no_duplicate_case_values: true
172+
no_leading_underscores_for_library_prefixes: true
173+
no_leading_underscores_for_local_identifiers: true
174+
no_literal_bool_comparisons: true
175+
no_logic_in_create_state: true
176+
no_runtimeType_toString: true
177+
no_self_assignments: true
178+
no_wildcard_variable_uses: true
179+
non_constant_identifier_names: true
180+
noop_primitive_operations: true
181+
null_check_on_nullable_type_parameter: true
182+
null_closures: true
183+
omit_local_variable_types: true
184+
omit_obvious_local_variable_types: true
185+
omit_obvious_property_types: true
186+
one_member_abstracts: true
187+
only_throw_errors: true
188+
overridden_fields: true
189+
package_names: true
190+
package_prefixed_library_names: true
191+
parameter_assignments: true
192+
prefer_adjacent_string_concatenation: true
193+
prefer_asserts_in_initializer_lists: true
194+
prefer_asserts_with_message: true
195+
prefer_collection_literals: true
196+
prefer_conditional_assignment: true
197+
prefer_const_constructors: true
198+
prefer_const_constructors_in_immutables: true
199+
prefer_const_declarations: true
200+
prefer_const_literals_to_create_immutables: true
201+
prefer_constructors_over_static_methods: true
202+
prefer_contains: true
203+
prefer_double_quotes: false # Conflicts with prefer_single_quotes
204+
prefer_expression_function_bodies: true
205+
prefer_final_fields: true
206+
prefer_final_in_for_each: true
207+
prefer_final_locals: true
208+
prefer_final_parameters: false # Conflicts with avoid_final_parameters. Covered by parameter_assignments.
209+
prefer_for_elements_to_map_fromIterable: true
210+
prefer_foreach: true
211+
prefer_function_declarations_over_variables: true
212+
prefer_generic_function_type_aliases: true
213+
prefer_if_elements_to_conditional_expressions: true
214+
prefer_if_null_operators: true
215+
prefer_initializing_formals: true
216+
prefer_inlined_adds: true
217+
prefer_int_literals: true
218+
prefer_interpolation_to_compose_strings: true
219+
prefer_is_empty: true
220+
prefer_is_not_empty: true
221+
prefer_is_not_operator: true
222+
prefer_iterable_whereType: true
223+
prefer_mixin: true
224+
prefer_null_aware_method_calls: true
225+
prefer_null_aware_operators: true
226+
prefer_relative_imports: true
227+
prefer_single_quotes: true
228+
prefer_spread_collections: true
229+
prefer_typing_uninitialized_variables: true
230+
prefer_void_to_null: true
231+
provide_deprecation_message: true
232+
public_member_api_docs: true
233+
recursive_getters: true
234+
require_trailing_commas: false # Made obsolete due to the new Dart formatter in 3.7
235+
secure_pubspec_urls: true
236+
sized_box_for_whitespace: true
237+
sized_box_shrink_expand: true
238+
slash_for_doc_comments: true
239+
sort_child_properties_last: true
240+
sort_constructors_first: true
241+
sort_pub_dependencies: true
242+
sort_unnamed_constructors_first: true
243+
specify_nonobvious_local_variable_types: false # Conflicts with omit_local_variable_types
244+
specify_nonobvious_property_types: false # Type inference by the plugin + IDE makes this obsolete
245+
strict_top_level_inference: true
246+
test_types_in_equals: true
247+
throw_in_finally: true
248+
tighten_type_of_initializing_formals: true
249+
type_annotate_public_apis: false # Conflicts with omit_obvious_property_types. Type is inferred is usually correctly done
250+
type_init_formals: true
251+
type_literal_in_constant_pattern: true
252+
unawaited_futures: false # Doesn't allow the use of `.unawaited` extension
253+
unintended_html_in_doc_comment: true
254+
unnecessary_async: true
255+
unnecessary_await_in_return: true
256+
unnecessary_brace_in_string_interps: true
257+
unnecessary_breaks: true
258+
unnecessary_const: true
259+
unnecessary_constructor_name: true
260+
unnecessary_final: false
261+
unnecessary_getters_setters: true
262+
unnecessary_lambdas: true
263+
unnecessary_late: true
264+
unnecessary_library_directive: true
265+
unnecessary_library_name: true
266+
unnecessary_new: true
267+
unnecessary_null_aware_assignments: true
268+
unnecessary_null_aware_operator_on_extension_on_nullable: true
269+
unnecessary_null_checks: true
270+
unnecessary_null_in_if_null_operators: true
271+
unnecessary_nullable_for_final_variable_declarations: true
272+
unnecessary_overrides: true
273+
unnecessary_parenthesis: true
274+
unnecessary_raw_strings: true
275+
unnecessary_statements: true
276+
unnecessary_string_escapes: true
277+
unnecessary_string_interpolations: true
278+
unnecessary_this: true
279+
unnecessary_to_list_in_spreads: true
280+
unnecessary_underscores: true
281+
unreachable_from_main: true
282+
unrelated_type_equality_checks: true
283+
unsafe_variance: false # Too pedantic. Actually unsafe in only a handful of cases.
284+
use_build_context_synchronously: true
285+
use_colored_box: true
286+
use_decorated_box: true
287+
use_enums: true
288+
use_full_hex_values_for_flutter_colors: true
289+
use_function_type_syntax_for_parameters: true
290+
use_if_null_to_convert_nulls_to_bools: true
291+
use_is_even_rather_than_modulo: true
292+
use_key_in_widget_constructors: true
293+
use_late_for_private_fields_and_variables: true
294+
use_named_constants: true
295+
use_raw_strings: true
296+
use_rethrow_when_possible: true
297+
use_setters_to_change_properties: true
298+
use_string_buffers: true
299+
use_string_in_part_of_directives: true
300+
use_super_parameters: true
301+
use_test_throws_matchers: true
302+
use_to_and_as_if_applicable: true
303+
use_truncating_division: true
304+
valid_regexps: true
305+
void_checks: true

example/enough_platform_widgets_example.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ class MyHomePage extends StatelessWidget {
2929
@override
3030
Widget build(BuildContext context) => PlatformScaffold(
3131
appBar: PlatformAppBar(
32-
title: Text('Hello World'),
32+
title: const Text('Hello World'),
3333
),
3434
body: Column(
3535
crossAxisAlignment: CrossAxisAlignment.start,
3636
children: [
3737
Expanded(
3838
child: ListView(
39-
children: [
39+
children: const [
4040
SelectablePlatformListTile(
4141
title: Text('List Tile 1'),
4242
),

lib/cupertino.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export 'src/cupertino/cupertino.dart';
2-
3-
export 'package:cupertino_stepper/cupertino_stepper.dart';
41
export 'package:cupertino_progress_bar/cupertino_progress_bar.dart';
2+
export 'package:cupertino_stepper/cupertino_stepper.dart';
3+
4+
export 'src/cupertino/cupertino.dart';

lib/enough_platform_widgets.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library enough_platform_widgets;
22

3-
export 'src/cupertino/cupertino.dart';
4-
export 'src/platform/platform.dart';
5-
63
export 'package:cupertino_stepper/cupertino_stepper.dart';
74
export 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
5+
6+
export 'src/cupertino/cupertino.dart';
7+
export 'src/platform/platform.dart';

lib/platform.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export 'src/platform/platform.dart';
2-
31
export 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
2+
3+
export 'src/platform/platform.dart';

lib/src/cupertino/cupertino.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
export 'cupertino_page_scaffold_with_toolbar.dart';
2-
export 'cupertino_toolbar.dart';
3-
export 'cupertino_page.dart';
4-
export 'cupertino_checkbox_list_tile.dart';
5-
export 'cupertino_radio_list_tile.dart';
61
export 'cupertino_bar.dart';
2+
export 'cupertino_checkbox_list_tile.dart';
73
export 'cupertino_chip.dart';
84
export 'cupertino_dropdown_button.dart';
9-
export 'cupertino_snack_app.dart';
10-
export 'cupertino_multiple_segmented.dart';
115
export 'cupertino_inkwell.dart';
6+
export 'cupertino_multiple_segmented.dart';
7+
export 'cupertino_page.dart';
8+
export 'cupertino_page_scaffold_with_toolbar.dart';
9+
export 'cupertino_radio_list_tile.dart';
1210
export 'cupertino_search.dart';
11+
export 'cupertino_snack_app.dart';
12+
export 'cupertino_toolbar.dart';

lib/src/cupertino/cupertino_checkbox_list_tile.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CupertinoCheckboxListTile extends StatelessWidget {
4040
CupertinoIcons.circle,
4141
color: highlightColor,
4242
);
43-
final padding = contentPadding ?? EdgeInsets.all(8.0);
43+
final padding = contentPadding ?? const EdgeInsets.all(8.0);
4444
final t = title;
4545
final st = subtitle;
4646
var content = t != null && st != null
@@ -49,11 +49,7 @@ class CupertinoCheckboxListTile extends StatelessWidget {
4949
mainAxisSize: MainAxisSize.min,
5050
children: [t, st],
5151
)
52-
: t != null
53-
? t
54-
: st != null
55-
? st
56-
: Container();
52+
: t ?? (st ?? Container());
5753
if (selected) {
5854
content = CupertinoTheme(
5955
data: CupertinoThemeData(

lib/src/cupertino/cupertino_chip.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CupertinoChip extends StatelessWidget {
3434
child: Container(
3535
decoration: BoxDecoration(
3636
border: Border.all(),
37-
borderRadius: BorderRadius.all(Radius.circular(8))),
37+
borderRadius: const BorderRadius.all(Radius.circular(8))),
3838
child: Padding(
3939
padding: const EdgeInsets.all(4.0),
4040
child: content,

0 commit comments

Comments
 (0)