Skip to content

Commit 42d9a2b

Browse files
authored
Sync lints (#126316)
Sync lints with https://github.com/dart-lang/linter/blob/master/example/all.yaml and enable `implicit_reopen` and `type_literal_in_constant_pattern` (which have no violations). Also contains some clean-up work towards enabling `matching_super_parameters`, which is not quite ready yet due to its handling of "private" arguments.
1 parent 0a63cd7 commit 42d9a2b

File tree

14 files changed

+29
-24
lines changed

14 files changed

+29
-24
lines changed

analysis_options.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ linter:
4242
- avoid_bool_literals_in_conditional_expressions
4343
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
4444
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
45-
# avoid_classes_with_only_static_members # # we do this commonly for `abstract final class`es
45+
# - avoid_classes_with_only_static_members # we do this commonly for `abstract final class`es
4646
- avoid_double_and_int_checks
4747
- avoid_dynamic_calls
4848
- avoid_empty_else
@@ -93,6 +93,7 @@ linter:
9393
- dangling_library_doc_comments
9494
- depend_on_referenced_packages
9595
- deprecated_consistency
96+
# - deprecated_member_use_from_same_package # we allow self-references to deprecated members
9697
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
9798
- directives_ordering
9899
# - discarded_futures # too many false positives, similar to unawaited_futures
@@ -107,6 +108,7 @@ linter:
107108
- hash_and_equals
108109
- implementation_imports
109110
- implicit_call_tearoffs
111+
- implicit_reopen
110112
- invalid_case_patterns
111113
- iterable_contains_unrelated_type
112114
# - join_return_with_assignment # not required by flutter style
@@ -118,12 +120,14 @@ linter:
118120
# - lines_longer_than_80_chars # not required by flutter style
119121
- list_remove_unrelated_type
120122
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
123+
# - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509
121124
- missing_whitespace_between_adjacent_strings
122125
- no_adjacent_strings_in_list
123126
- no_default_cases
124127
- no_duplicate_case_values
125128
- no_leading_underscores_for_library_prefixes
126129
- no_leading_underscores_for_local_identifiers
130+
# - no_literal_bool_comparisons # needs quick fix, https://github.com/dart-lang/linter/issues/4333
127131
- no_logic_in_create_state
128132
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
129133
- non_constant_identifier_names
@@ -194,6 +198,7 @@ linter:
194198
- tighten_type_of_initializing_formals
195199
# - type_annotate_public_apis # subset of always_specify_types
196200
- type_init_formals
201+
- type_literal_in_constant_pattern
197202
# - unawaited_futures # too many false positives, especially with the way AnimationController works
198203
- unnecessary_await_in_return
199204
- unnecessary_brace_in_string_interps

dev/tools/gen_keycodes/lib/android_code_gen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'utils.dart';
1414
/// Generates the key mapping for Android, based on the information in the key
1515
/// data structure given to it.
1616
class AndroidCodeGenerator extends PlatformCodeGenerator {
17-
AndroidCodeGenerator(super.physicalData, super.logicalData);
17+
AndroidCodeGenerator(super.keyData, super.logicalData);
1818

1919
/// This generates the map of Android key codes to logical keys.
2020
String get _androidKeyCodeMap {

packages/flutter/lib/src/cupertino/route.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
894894
class _CupertinoEdgeShadowPainter extends BoxPainter {
895895
_CupertinoEdgeShadowPainter(
896896
this._decoration,
897-
super.onChange,
897+
super.onChanged,
898898
) : assert(_decoration._colors == null || _decoration._colors!.length > 1);
899899

900900
final _CupertinoEdgeShadowDecoration _decoration;

packages/flutter/lib/src/gestures/multidrag.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ abstract class MultiDragGestureRecognizer extends GestureRecognizer {
328328
}
329329

330330
class _ImmediatePointerState extends MultiDragPointerState {
331-
_ImmediatePointerState(super.initialPosition, super.kind, super.deviceGestureSettings);
331+
_ImmediatePointerState(super.initialPosition, super.kind, super.gestureSettings);
332332

333333
@override
334334
void checkForResolutionAfterMove() {
@@ -381,7 +381,7 @@ class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
381381

382382

383383
class _HorizontalPointerState extends MultiDragPointerState {
384-
_HorizontalPointerState(super.initialPosition, super.kind, super.deviceGestureSettings);
384+
_HorizontalPointerState(super.initialPosition, super.kind, super.gestureSettings);
385385

386386
@override
387387
void checkForResolutionAfterMove() {
@@ -434,7 +434,7 @@ class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
434434

435435

436436
class _VerticalPointerState extends MultiDragPointerState {
437-
_VerticalPointerState(super.initialPosition, super.kind, super.deviceGestureSettings);
437+
_VerticalPointerState(super.initialPosition, super.kind, super.gestureSettings);
438438

439439
@override
440440
void checkForResolutionAfterMove() {
@@ -486,7 +486,7 @@ class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
486486
}
487487

488488
class _DelayedPointerState extends MultiDragPointerState {
489-
_DelayedPointerState(super.initialPosition, Duration delay, super.kind, super.deviceGestureSettings) {
489+
_DelayedPointerState(super.initialPosition, Duration delay, super.kind, super.gestureSettings) {
490490
_timer = Timer(delay, _delayPassed);
491491
}
492492

packages/flutter/lib/src/widgets/scroll_delegate.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ abstract class SliverChildDelegate {
225225
}
226226

227227
class _SaltedValueKey extends ValueKey<Key> {
228-
const _SaltedValueKey(super.key);
228+
const _SaltedValueKey(super.value);
229229
}
230230

231231
/// Called to find the new index of a child based on its `key` in case of

packages/flutter/test/widgets/image_resolution_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class FakeImageStreamCompleter extends ImageStreamCompleter {
7070
}
7171

7272
class TestAssetImage extends AssetImage {
73-
const TestAssetImage(super.name, this.images);
73+
const TestAssetImage(super.assetName, this.images);
7474

7575
final Map<double, ui.Image> images;
7676

packages/flutter_driver/lib/src/common/frame_sync.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class SetFrameSync extends Command {
1010
const SetFrameSync(this.enabled, { super.timeout });
1111

1212
/// Deserializes this command from the value generated by [serialize].
13-
SetFrameSync.deserialize(super.params)
14-
: enabled = params['enabled']!.toLowerCase() == 'true',
13+
SetFrameSync.deserialize(super.json)
14+
: enabled = json['enabled']!.toLowerCase() == 'true',
1515
super.deserialize();
1616

1717
/// Whether frameSync should be enabled or disabled.

packages/flutter_driver/lib/src/common/request_data.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class RequestData extends Command {
1111
const RequestData(this.message, { super.timeout });
1212

1313
/// Deserializes this command from the value generated by [serialize].
14-
RequestData.deserialize(super.params)
15-
: message = params['message'],
14+
RequestData.deserialize(super.json)
15+
: message = json['message'],
1616
super.deserialize();
1717

1818
/// The message being sent from the test to the application.

packages/flutter_driver/lib/src/common/semantics.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class SetSemantics extends Command {
1010
const SetSemantics(this.enabled, { super.timeout });
1111

1212
/// Deserializes this command from the value generated by [serialize].
13-
SetSemantics.deserialize(super.params)
14-
: enabled = params['enabled']!.toLowerCase() == 'true',
13+
SetSemantics.deserialize(super.json)
14+
: enabled = json['enabled']!.toLowerCase() == 'true',
1515
super.deserialize();
1616

1717
/// Whether semantics should be enabled (true) or disabled (false).

packages/flutter_tools/lib/src/desktop_device.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import 'protocol_discovery.dart';
2121
/// A partial implementation of Device for desktop-class devices to inherit
2222
/// from, containing implementations that are common to all desktop devices.
2323
abstract class DesktopDevice extends Device {
24-
DesktopDevice(super.identifier, {
24+
DesktopDevice(super.id, {
2525
required PlatformType super.platformType,
2626
required super.ephemeral,
2727
required Logger logger,

0 commit comments

Comments
 (0)