Skip to content

Commit 7df127b

Browse files
authored
Enable strict_top_level_inference (#160674)
Only observation: It forces a type on `_` parameters.
1 parent d9e5a5c commit 7df127b

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

analysis_options.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# which should be kept in sync with this file:
99
#
1010
# - analysis_options.yaml (this file)
11-
# - https://github.com/flutter/engine/blob/main/analysis_options.yaml
11+
# - engine/src/flutter/analysis_options.yaml
1212
# - https://github.com/flutter/packages/blob/main/analysis_options.yaml
1313
#
1414
# This file contains the analysis options used for code in the flutter/flutter
@@ -58,6 +58,7 @@ linter:
5858
- avoid_field_initializers_in_const_classes
5959
# - avoid_final_parameters # incompatible with prefer_final_parameters
6060
- avoid_function_literals_in_foreach_calls
61+
# - avoid_futureor_void # not yet tested
6162
# - avoid_implementing_value_types # see https://github.com/dart-lang/linter/issues/4558
6263
- avoid_init_to_null
6364
- avoid_js_rounded_ints
@@ -146,10 +147,10 @@ linter:
146147
- null_closures
147148
# - omit_local_variable_types # opposite of always_specify_types
148149
# - omit_obvious_local_variable_types # not yet tested
150+
# - omit_obvious_property_types # not yet tested
149151
# - one_member_abstracts # too many false positives
150152
- only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al
151153
- overridden_fields
152-
# - package_api_docs # Deprecated (https://github.com/dart-lang/linter/issues/5107)
153154
- package_names
154155
- package_prefixed_library_names
155156
# - parameter_assignments # we do this commonly
@@ -205,6 +206,8 @@ linter:
205206
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
206207
- sort_unnamed_constructors_first
207208
# - specify_nonobvious_local_variable_types # not yet tested
209+
# - specify_nonobvious_property_types # not yet tested
210+
- strict_top_level_inference
208211
- test_types_in_equals
209212
- throw_in_finally
210213
- tighten_type_of_initializing_formals
@@ -240,6 +243,7 @@ linter:
240243
- unnecessary_to_list_in_spreads
241244
- unreachable_from_main
242245
- unrelated_type_equality_checks
246+
# - unsafe_variance # not yet tested
243247
- use_build_context_synchronously
244248
- use_colored_box
245249
# - use_decorated_box # leads to bugs: DecoratedBox and Container are not equivalent (Container inserts extra padding)

packages/flutter/lib/src/material/dropdown_menu.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
808808
return result;
809809
}
810810

811-
void handleUpKeyInvoke(_) {
811+
void handleUpKeyInvoke(_ArrowUpIntent _) {
812812
setState(() {
813813
if (!widget.enabled || !_menuHasEnabledItem || !_controller.isOpen) {
814814
return;
@@ -828,7 +828,7 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
828828
});
829829
}
830830

831-
void handleDownKeyInvoke(_) {
831+
void handleDownKeyInvoke(_ArrowDownIntent _) {
832832
setState(() {
833833
if (!widget.enabled || !_menuHasEnabledItem || !_controller.isOpen) {
834834
return;

packages/flutter/lib/src/material/page_transitions_theme.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ class _ZoomEnterTransitionPainter extends SnapshotPainter {
13051305
fade.addListener(notifyListeners);
13061306
}
13071307

1308-
void _onStatusChange(_) {
1308+
void _onStatusChange(AnimationStatus _) {
13091309
notifyListeners();
13101310
}
13111311

@@ -1414,7 +1414,7 @@ class _ZoomExitTransitionPainter extends SnapshotPainter {
14141414
animation.addStatusListener(_onStatusChange);
14151415
}
14161416

1417-
void _onStatusChange(_) {
1417+
void _onStatusChange(AnimationStatus _) {
14181418
notifyListeners();
14191419
}
14201420

packages/flutter/test/foundation/isolates_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'dart:io';
66
import 'dart:isolate';
7+
78
import 'package:file/file.dart';
89
import 'package:file/local.dart';
910
import 'package:flutter/foundation.dart';
@@ -168,11 +169,11 @@ dynamic testInvalidError(int square) {
168169
}
169170
}
170171

171-
String? testDebugName(_) {
172+
String? testDebugName(void _) {
172173
return Isolate.current.debugName;
173174
}
174175

175-
int? testReturnNull(_) {
176+
int? testReturnNull(void _) {
176177
return null;
177178
}
178179

0 commit comments

Comments
 (0)