diff --git a/analysis_options.yaml b/analysis_options.yaml index f4e9378bdf958..7236240287347 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,7 +1,7 @@ # Specify analysis options. # # This file is a copy of analysis_options.yaml from flutter repo -# as of 2023-03-22, but with some modifications marked with +# as of 2023-12-18, but with some modifications marked with # "DIFFERENT FROM FLUTTER/FLUTTER" below. analyzer: @@ -20,7 +20,7 @@ analyzer: linter: rules: # This list is derived from the list of all available lints located at - # https://github.com/dart-lang/linter/blob/master/example/all.yaml + # https://github.com/dart-lang/linter/blob/main/example/all.yaml - always_declare_return_types - always_put_control_body_on_new_line # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 @@ -31,7 +31,7 @@ linter: - avoid_bool_literals_in_conditional_expressions # - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023 # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023 - # - avoid_classes_with_only_static_members # we do this commonly + # - avoid_classes_with_only_static_members # we do this commonly for `abstract final class`es - avoid_double_and_int_checks - avoid_dynamic_calls - avoid_empty_else @@ -40,7 +40,7 @@ linter: - avoid_field_initializers_in_const_classes # - avoid_final_parameters # incompatible with prefer_final_parameters - avoid_function_literals_in_foreach_calls - - avoid_implementing_value_types + # - avoid_implementing_value_types # see https://github.com/dart-lang/linter/issues/4558 - avoid_init_to_null - avoid_js_rounded_ints # - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to @@ -82,6 +82,7 @@ linter: - dangling_library_doc_comments - depend_on_referenced_packages - deprecated_consistency + # - deprecated_member_use_from_same_package # we allow self-references to deprecated members # - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib) - directives_ordering # - discarded_futures # too many false positives, similar to unawaited_futures @@ -96,8 +97,8 @@ linter: - hash_and_equals - implementation_imports - implicit_call_tearoffs + - implicit_reopen - invalid_case_patterns - - iterable_contains_unrelated_type # - join_return_with_assignment # not required by flutter style - leading_newlines_in_multiline_strings - library_annotations @@ -105,16 +106,19 @@ linter: - library_prefixes - library_private_types_in_public_api # - lines_longer_than_80_chars # not required by flutter style - - list_remove_unrelated_type - # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453 + - literal_only_boolean_expressions + # - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509 # - missing_whitespace_between_adjacent_strings # DIFFERENT FROM FLUTTER/FLUTTER (too many false positives) - no_adjacent_strings_in_list - no_default_cases - no_duplicate_case_values - no_leading_underscores_for_library_prefixes - no_leading_underscores_for_local_identifiers + - no_literal_bool_comparisons - no_logic_in_create_state # - no_runtimeType_toString # ok in tests; we enable this only in packages/ + - no_self_assignments + - no_wildcard_variable_uses - non_constant_identifier_names - noop_primitive_operations - null_check_on_nullable_type_parameter @@ -143,7 +147,7 @@ linter: - prefer_final_fields - prefer_final_in_for_each - prefer_final_locals - # - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments + # - prefer_final_parameters # adds too much verbosity - prefer_for_elements_to_map_fromIterable - prefer_foreach - prefer_function_declarations_over_variables @@ -183,6 +187,7 @@ linter: - tighten_type_of_initializing_formals # - type_annotate_public_apis # subset of always_specify_types - type_init_formals + - type_literal_in_constant_pattern # - unawaited_futures # too many false positives, especially with the way AnimationController works - unnecessary_await_in_return - unnecessary_brace_in_string_interps @@ -208,7 +213,7 @@ linter: - unnecessary_string_interpolations - unnecessary_this - unnecessary_to_list_in_spreads - # - unreachable_from_main # Do not enable this rule until it is un-marked as "experimental" and carefully re-evaluated. + - unreachable_from_main - unrelated_type_equality_checks - unsafe_html - use_build_context_synchronously diff --git a/ci/bin/format.dart b/ci/bin/format.dart index 8e1c1b1d6b3c6..3eebfb238969e 100644 --- a/ci/bin/format.dart +++ b/ci/bin/format.dart @@ -20,8 +20,6 @@ class FormattingException implements Exception { final String message; final ProcessResult? result; - int get exitCode => result?.exitCode ?? -1; - @override String toString() { final StringBuffer output = StringBuffer(runtimeType.toString()); @@ -109,7 +107,6 @@ abstract class FormatChecker { ProcessManager processManager = const LocalProcessManager(), required this.baseGitRef, required this.repoDir, - required this.srcDir, this.allFiles = false, this.messageCallback, }) : _processRunner = ProcessRunner( @@ -142,7 +139,6 @@ abstract class FormatChecker { processManager: processManager, baseGitRef: baseGitRef, repoDir: repoDir, - srcDir: srcDir, allFiles: allFiles, messageCallback: messageCallback, ); @@ -160,7 +156,6 @@ abstract class FormatChecker { processManager: processManager, baseGitRef: baseGitRef, repoDir: repoDir, - srcDir: srcDir, allFiles: allFiles, messageCallback: messageCallback, ); @@ -169,7 +164,6 @@ abstract class FormatChecker { processManager: processManager, baseGitRef: baseGitRef, repoDir: repoDir, - srcDir: srcDir, allFiles: allFiles, messageCallback: messageCallback, ); @@ -177,7 +171,6 @@ abstract class FormatChecker { } final ProcessRunner _processRunner; - final Directory srcDir; final Directory repoDir; final bool allFiles; MessageCallback? messageCallback; @@ -302,9 +295,7 @@ class ClangFormatChecker extends FormatChecker { required Directory srcDir, super.allFiles, super.messageCallback, - }) : super( - srcDir: srcDir, - ) { + }) { /*late*/ String clangOs; if (Platform.isLinux) { clangOs = 'linux-x64'; @@ -462,9 +453,7 @@ class JavaFormatChecker extends FormatChecker { required Directory srcDir, super.allFiles, super.messageCallback, - }) : super( - srcDir: srcDir, - ) { + }) { googleJavaFormatJar = File( path.absolute( path.join( @@ -619,7 +608,6 @@ class GnFormatChecker extends FormatChecker { super.processManager, required super.baseGitRef, required Directory repoDir, - required super.srcDir, super.allFiles, super.messageCallback, }) : super( @@ -750,7 +738,6 @@ class PythonFormatChecker extends FormatChecker { super.processManager, required super.baseGitRef, required Directory repoDir, - required super.srcDir, super.allFiles, super.messageCallback, }) : super( @@ -845,7 +832,6 @@ class WhitespaceFormatChecker extends FormatChecker { super.processManager, required super.baseGitRef, required super.repoDir, - required super.srcDir, super.allFiles, super.messageCallback, }); diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index 6c6ab50a78b67..89e6ae151857c 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 5e484e46971049766e74d801d325ad63 +Signature: b0fbe71c20bdf5b2a1c163281b1f90de diff --git a/ci/test/format_test.dart b/ci/test/format_test.dart index 78af163bad6bd..c603e800eb24f 100644 --- a/ci/test/format_test.dart +++ b/ci/test/format_test.dart @@ -6,43 +6,34 @@ import 'dart:io' as io; import 'package:litetest/litetest.dart'; import 'package:path/path.dart' as path; -import 'package:process_runner/process_runner.dart'; import '../bin/format.dart' as target; final io.File script = io.File.fromUri(io.Platform.script).absolute; final io.Directory repoDir = script.parent.parent.parent; -final ProcessPool pool = ProcessPool( - numWorkers: 1, - processRunner: ProcessRunner(defaultWorkingDirectory: repoDir), -); class FileContentPair { - FileContentPair(this.original, this.formatted, this.fileExtension); + FileContentPair(this.original, this.formatted); final String original; final String formatted; - final String fileExtension; } final FileContentPair ccContentPair = FileContentPair( - 'int main(){return 0;}\n', 'int main() {\n return 0;\n}\n', '.cc'); + 'int main(){return 0;}\n', 'int main() {\n return 0;\n}\n'); final FileContentPair hContentPair = - FileContentPair('int\nmain\n()\n;\n', 'int main();\n', '.h'); + FileContentPair('int\nmain\n()\n;\n', 'int main();\n'); final FileContentPair gnContentPair = FileContentPair( - 'test\n(){testvar=true}\n', 'test() {\n testvar = true\n}\n', '.gn'); + 'test\n(){testvar=true}\n', 'test() {\n testvar = true\n}\n'); final FileContentPair javaContentPair = FileContentPair( 'class Test{public static void main(String args[]){System.out.println("Test");}}\n', - 'class Test {\n public static void main(String args[]) {\n System.out.println("Test");\n }\n}\n', - '.java'); + 'class Test {\n public static void main(String args[]) {\n System.out.println("Test");\n }\n}\n'); final FileContentPair pythonContentPair = FileContentPair( "if __name__=='__main__':\n sys.exit(\nMain(sys.argv)\n)\n", - "if __name__ == '__main__':\n sys.exit(Main(sys.argv))\n", - '.py'); + "if __name__ == '__main__':\n sys.exit(Main(sys.argv))\n"); final FileContentPair whitespaceContentPair = FileContentPair( 'int main() {\n return 0; \n}\n', - 'int main() {\n return 0;\n}\n', - '.c'); + 'int main() {\n return 0;\n}\n'); class TestFileFixture { TestFileFixture(this.type) { @@ -106,31 +97,26 @@ class TestFileFixture { path.extension(file.path) == '.cc' ? ccContentPair.formatted : hContentPair.formatted, - path.extension(file.path), ); case target.FormatCheck.gn: return FileContentPair( content, gnContentPair.formatted, - path.extension(file.path), ); case target.FormatCheck.java: return FileContentPair( content, javaContentPair.formatted, - path.extension(file.path), ); case target.FormatCheck.python: return FileContentPair( content, pythonContentPair.formatted, - path.extension(file.path), ); case target.FormatCheck.whitespace: return FileContentPair( content, whitespaceContentPair.formatted, - path.extension(file.path), ); } }); diff --git a/lib/ui/analysis_options.yaml b/lib/ui/analysis_options.yaml index df714af989148..e84ed2920e8f6 100644 --- a/lib/ui/analysis_options.yaml +++ b/lib/ui/analysis_options.yaml @@ -4,3 +4,7 @@ analyzer: exclude: # fixtures/ depends on dart:ui and raises false positives. - fixtures/** + +linter: + rules: + unreachable_from_main: false # lint not compatible with how dart:ui is structured diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index b2a143669e131..10b532e20cb2a 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1501,7 +1501,7 @@ class Paint { } semicolon = '; '; } - if (isAntiAlias != true) { + if (!isAntiAlias) { result.write('${semicolon}antialias off'); semicolon = '; '; } @@ -6864,9 +6864,7 @@ base class _NativeImageDescriptor extends NativeFieldWrapperClass1 implements Im targetHeight = height; } else if (targetWidth == null && targetHeight != null) { targetWidth = (targetHeight * (width / height)).round(); - targetHeight = targetHeight; } else if (targetHeight == null && targetWidth != null) { - targetWidth = targetWidth; targetHeight = targetWidth ~/ (width / height); } assert(targetWidth != null); diff --git a/lib/web_ui/lib/src/engine/canvaskit/image.dart b/lib/web_ui/lib/src/engine/canvaskit/image.dart index fd822860c1d0f..23c585f7f8a48 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/image.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/image.dart @@ -113,9 +113,7 @@ CkImage scaleImage(SkImage image, int? targetWidth, int? targetHeight) { } if (targetWidth == null && targetHeight != null) { targetWidth = (targetHeight * (image.width() / image.height())).round(); - targetHeight = targetHeight; } else if (targetHeight == null && targetWidth != null) { - targetWidth = targetWidth; targetHeight = targetWidth ~/ (image.width() / image.height()); } diff --git a/lib/web_ui/lib/src/engine/html/painting.dart b/lib/web_ui/lib/src/engine/html/painting.dart index bab36c6740134..4d44b8604a53b 100644 --- a/lib/web_ui/lib/src/engine/html/painting.dart +++ b/lib/web_ui/lib/src/engine/html/painting.dart @@ -203,7 +203,7 @@ class SurfacePaint implements ui.Paint { } semicolon = '; '; } - if (isAntiAlias != true) { + if (!isAntiAlias) { result.write('${semicolon}antialias off'); semicolon = '; '; } diff --git a/lib/web_ui/lib/src/engine/html/recording_canvas.dart b/lib/web_ui/lib/src/engine/html/recording_canvas.dart index c323b480662d9..1494cf333d085 100644 --- a/lib/web_ui/lib/src/engine/html/recording_canvas.dart +++ b/lib/web_ui/lib/src/engine/html/recording_canvas.dart @@ -553,7 +553,7 @@ class RecordingCanvas { return; } final RecordingCanvas pictureRecording = enginePicture.recordingCanvas!; - if (pictureRecording._didDraw == true) { + if (pictureRecording._didDraw) { _didDraw = true; } renderStrategy.merge(pictureRecording.renderStrategy); diff --git a/lib/web_ui/lib/src/engine/semantics/text_field.dart b/lib/web_ui/lib/src/engine/semantics/text_field.dart index c3195c1d414ac..ce9d61433bcb7 100644 --- a/lib/web_ui/lib/src/engine/semantics/text_field.dart +++ b/lib/web_ui/lib/src/engine/semantics/text_field.dart @@ -152,8 +152,6 @@ class SemanticsTextEditingStrategy extends DefaultTextEditingStrategy { {OnChangeCallback? onChange, OnActionCallback? onAction}) { isEnabled = true; inputConfiguration = inputConfig; - onChange = onChange; - onAction = onAction; applyConfiguration(inputConfig); } diff --git a/lib/web_ui/lib/src/engine/text_editing/text_editing.dart b/lib/web_ui/lib/src/engine/text_editing/text_editing.dart index a9a645de70be5..af1b98a7d0bb7 100644 --- a/lib/web_ui/lib/src/engine/text_editing/text_editing.dart +++ b/lib/web_ui/lib/src/engine/text_editing/text_editing.dart @@ -1506,18 +1506,18 @@ abstract class DefaultTextEditingStrategy with CompositionAwareMixin implements /// see: https://bugs.chromium.org/p/chromium/issues/detail?id=119216#c11. void preventDefaultForMouseEvents() { subscriptions.add( - DomSubscription(activeDomElement, 'mousedown', (_) { - _.preventDefault(); + DomSubscription(activeDomElement, 'mousedown', (DomEvent event) { + event.preventDefault(); })); subscriptions.add( - DomSubscription(activeDomElement, 'mouseup', (_) { - _.preventDefault(); + DomSubscription(activeDomElement, 'mouseup', (DomEvent event) { + event.preventDefault(); })); subscriptions.add( - DomSubscription(activeDomElement, 'mousemove', (_) { - _.preventDefault(); + DomSubscription(activeDomElement, 'mousemove', (DomEvent event) { + event.preventDefault(); })); } } diff --git a/lib/web_ui/test/canvaskit/render_canvas_factory_test.dart b/lib/web_ui/test/canvaskit/render_canvas_factory_test.dart index a627158ffc72d..fb5f04fbac7a7 100644 --- a/lib/web_ui/test/canvaskit/render_canvas_factory_test.dart +++ b/lib/web_ui/test/canvaskit/render_canvas_factory_test.dart @@ -8,8 +8,6 @@ import 'package:ui/src/engine.dart'; import 'common.dart'; -const MethodCodec codec = StandardMethodCodec(); - void main() { internalBootstrapBrowserTest(() => testMain); } diff --git a/lib/web_ui/test/engine/history_test.dart b/lib/web_ui/test/engine/history_test.dart index f48ed13bed9db..72fc4e16ecb7f 100644 --- a/lib/web_ui/test/engine/history_test.dart +++ b/lib/web_ui/test/engine/history_test.dart @@ -27,7 +27,6 @@ Map _tagStateWithSerialCount(dynamic state, int serialCount) { }; } -const Map originState = {'origin': true}; const Map flutterState = {'flutter': true}; const MethodCodec codec = JSONMethodCodec(); diff --git a/lib/web_ui/test/engine/keyboard_converter_test.dart b/lib/web_ui/test/engine/keyboard_converter_test.dart index 74b2ee95db401..8b11990030bac 100644 --- a/lib/web_ui/test/engine/keyboard_converter_test.dart +++ b/lib/web_ui/test/engine/keyboard_converter_test.dart @@ -11,7 +11,6 @@ import 'package:ui/ui.dart' as ui; import '../common/keyboard_test_common.dart'; -const int kLocationStandard = 0; const int kLocationLeft = 1; const int kLocationRight = 2; const int kLocationNumpad = 3; @@ -25,7 +24,6 @@ final int kPhysicalNumpad1 = kWebToPhysicalKey['Numpad1']!; final int kPhysicalShiftLeft = kWebToPhysicalKey['ShiftLeft']!; final int kPhysicalShiftRight = kWebToPhysicalKey['ShiftRight']!; final int kPhysicalMetaLeft = kWebToPhysicalKey['MetaLeft']!; -final int kPhysicalTab = kWebToPhysicalKey['Tab']!; final int kPhysicalCapsLock = kWebToPhysicalKey['CapsLock']!; final int kPhysicalScrollLock = kWebToPhysicalKey['ScrollLock']!; // A web-specific physical key when code is empty. @@ -41,12 +39,9 @@ final int kLogicalShiftRight = kWebLogicalLocationMap['Shift']![kLocationRight]! final int kLogicalCtrlLeft = kWebLogicalLocationMap['Control']![kLocationLeft]!; final int kLogicalAltLeft = kWebLogicalLocationMap['Alt']![kLocationLeft]!; final int kLogicalMetaLeft = kWebLogicalLocationMap['Meta']![kLocationLeft]!; -const int kLogicalTab = 0x0000000009; final int kLogicalCapsLock = kWebToLogicalKey['CapsLock']!; final int kLogicalScrollLock = kWebToLogicalKey['ScrollLock']!; -typedef VoidCallback = void Function(); - void main() { internalBootstrapBrowserTest(() => testMain); } @@ -1151,11 +1146,6 @@ MockKeyboardEvent keyRepeatedDownEvent(String code, String key, [int modifiers = ); } -// Flags used for the `activeLocks` argument of expectKeyData. -const int kCapsLock = 0x1; -const int kNumlLock = 0x2; -const int kScrollLock = 0x4; - void expectKeyData( ui.KeyData target, { required ui.KeyEventType type, diff --git a/lib/web_ui/test/engine/navigation_test.dart b/lib/web_ui/test/engine/navigation_test.dart index f9a01ea5c32cf..8db1d8894feb5 100644 --- a/lib/web_ui/test/engine/navigation_test.dart +++ b/lib/web_ui/test/engine/navigation_test.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:typed_data'; import 'package:test/bootstrap/browser.dart'; import 'package:test/test.dart'; @@ -16,8 +15,6 @@ const engine.MethodCodec codec = engine.JSONMethodCodec(); engine.EngineFlutterWindow get implicitView => engine.EnginePlatformDispatcher.instance.implicitView!; -void emptyCallback(ByteData date) {} - void main() { internalBootstrapBrowserTest(() => testMain); } diff --git a/lib/web_ui/test/engine/routing_test.dart b/lib/web_ui/test/engine/routing_test.dart index ddc9669dd8374..e5713cd49b34e 100644 --- a/lib/web_ui/test/engine/routing_test.dart +++ b/lib/web_ui/test/engine/routing_test.dart @@ -13,8 +13,6 @@ import 'package:ui/ui_web/src/ui_web.dart' as ui_web; import '../common/matchers.dart'; import 'history_test.dart'; -const MethodCodec codec = JSONMethodCodec(); - Map _tagStateWithSerialCount(dynamic state, int serialCount) { return { 'serialCount': serialCount, diff --git a/lib/web_ui/test/engine/semantics/semantics_placeholder_enable_test.dart b/lib/web_ui/test/engine/semantics/semantics_placeholder_enable_test.dart index c88ccb78db3cb..b3d7f440316fe 100644 --- a/lib/web_ui/test/engine/semantics/semantics_placeholder_enable_test.dart +++ b/lib/web_ui/test/engine/semantics/semantics_placeholder_enable_test.dart @@ -12,7 +12,6 @@ import 'package:ui/src/engine.dart'; import '../../common/test_initialization.dart'; EngineSemantics semantics() => EngineSemantics.instance; -EngineSemanticsOwner owner() => EnginePlatformDispatcher.instance.implicitView!.semantics; void main() { internalBootstrapBrowserTest(() { diff --git a/lib/web_ui/test/engine/semantics/semantics_test.dart b/lib/web_ui/test/engine/semantics/semantics_test.dart index b3b210614f335..d461713fd6f97 100644 --- a/lib/web_ui/test/engine/semantics/semantics_test.dart +++ b/lib/web_ui/test/engine/semantics/semantics_test.dart @@ -3137,14 +3137,3 @@ Future createPlatformView(int id, String viewType) { ); return completer.future; } - -/// Disposes of the platform view with the given [id]. -Future disposePlatformView(int id) { - final Completer completer = Completer(); - ui.PlatformDispatcher.instance.sendPlatformMessage( - 'flutter/platform_views', - codec.encodeMethodCall(MethodCall('dispose', id)), - (dynamic _) => completer.complete(), - ); - return completer.future; -} diff --git a/lib/web_ui/test/engine/surface/path/path_winding_test.dart b/lib/web_ui/test/engine/surface/path/path_winding_test.dart index 2d4f1692d931d..9f0953004ba5b 100644 --- a/lib/web_ui/test/engine/surface/path/path_winding_test.dart +++ b/lib/web_ui/test/engine/surface/path/path_winding_test.dart @@ -54,20 +54,18 @@ void testMain() { test('moveto/lineto convexity', () { final List testCases = [ - LineTestCase('', SPathConvexityType.kConvex, SPathDirection.kUnknown), + LineTestCase('', SPathConvexityType.kConvex), LineTestCase( - '0 0', SPathConvexityType.kConvex, SPathDirection.kUnknown), + '0 0', SPathConvexityType.kConvex), LineTestCase( - '0 0 10 10', SPathConvexityType.kConvex, SPathDirection.kUnknown), - LineTestCase('0 0 10 10 20 20 0 0 10 10', SPathConvexityType.kConcave, - SPathDirection.kUnknown), + '0 0 10 10', SPathConvexityType.kConvex), + LineTestCase('0 0 10 10 20 20 0 0 10 10', SPathConvexityType.kConcave), LineTestCase( - '0 0 10 10 10 20', SPathConvexityType.kConvex, SPathDirection.kCW), + '0 0 10 10 10 20', SPathConvexityType.kConvex), LineTestCase( - '0 0 10 10 10 0', SPathConvexityType.kConvex, SPathDirection.kCCW), - LineTestCase('0 0 10 10 10 0 0 10', SPathConvexityType.kConcave, null), - LineTestCase('0 0 10 0 0 10 -10 -10', SPathConvexityType.kConcave, - SPathDirection.kCW), + '0 0 10 10 10 0', SPathConvexityType.kConvex), + LineTestCase('0 0 10 10 10 0 0 10', SPathConvexityType.kConcave), + LineTestCase('0 0 10 0 0 10 -10 -10', SPathConvexityType.kConcave), ]; for (final LineTestCase testCase in testCases) { @@ -418,10 +416,9 @@ void testMain() { } class LineTestCase { - LineTestCase(this.pathContent, this.convexity, this.direction); + LineTestCase(this.pathContent, this.convexity); final String pathContent; final int convexity; - final int? direction; } /// Parses a string of the format "mx my lx1 ly1 lx2 ly2..." into a path diff --git a/lib/web_ui/test/engine/surface/platform_view_test.dart b/lib/web_ui/test/engine/surface/platform_view_test.dart index 9cb19a40e5016..52114b86f8fa4 100644 --- a/lib/web_ui/test/engine/surface/platform_view_test.dart +++ b/lib/web_ui/test/engine/surface/platform_view_test.dart @@ -14,10 +14,6 @@ import '../../common/matchers.dart'; import '../../common/test_initialization.dart'; const MethodCodec codec = StandardMethodCodec(); -final EngineFlutterWindow window = EngineFlutterView.implicit( - EnginePlatformDispatcher.instance, - createDomHTMLDivElement(), -); void main() { internalBootstrapBrowserTest(() => testMain); diff --git a/lib/web_ui/test/html/compositing/color_filter_golden_test.dart b/lib/web_ui/test/html/compositing/color_filter_golden_test.dart index faf6260620e75..c8155756f3074 100644 --- a/lib/web_ui/test/html/compositing/color_filter_golden_test.dart +++ b/lib/web_ui/test/html/compositing/color_filter_golden_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:js_util' as js_util; - import 'package:test/bootstrap/browser.dart'; import 'package:test/test.dart'; import 'package:ui/src/engine.dart'; @@ -126,21 +124,3 @@ Picture _drawBackground() { ..color = const Color(0xFFE0FFE0)) as SurfacePaint); return recorder.endRecording(); } - -HtmlImage createTestImage({int width = 200, int height = 150}) { - final DomCanvasElement canvas = - createDomCanvasElement(width: width, height: height); - final DomCanvasRenderingContext2D ctx = canvas.context2D; - ctx.fillStyle = '#E04040'; - ctx.fillRect(0, 0, width / 3, height); - ctx.fill(); - ctx.fillStyle = '#40E080'; - ctx.fillRect(width / 3, 0, width / 3, height); - ctx.fill(); - ctx.fillStyle = '#2040E0'; - ctx.fillRect(2 * width / 3, 0, width / 3, height); - ctx.fill(); - final DomHTMLImageElement imageElement = createDomHTMLImageElement(); - imageElement.src = js_util.callMethod(canvas, 'toDataURL', []); - return HtmlImage(imageElement, width, height); -} diff --git a/lib/web_ui/test/html/drawing/canvas_draw_picture_golden_test.dart b/lib/web_ui/test/html/drawing/canvas_draw_picture_golden_test.dart index 6b6974b937ceb..d40996ee5968b 100644 --- a/lib/web_ui/test/html/drawing/canvas_draw_picture_golden_test.dart +++ b/lib/web_ui/test/html/drawing/canvas_draw_picture_golden_test.dart @@ -136,8 +136,6 @@ Picture _drawGreenRectIntoPicture() { return recorder.endRecording(); } -typedef PaintCallback = void Function(RecordingCanvas canvas); - const String _base64Encoded20x20TestImage = 'iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAC4jAAAuIwF4pT92AAAA' 'B3RJTUUH5AMFFBksg4i3gQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAj' diff --git a/lib/web_ui/test/html/paragraph/text_overflow_golden_test.dart b/lib/web_ui/test/html/paragraph/text_overflow_golden_test.dart index 26744ec87da9a..c3cb0cb2c20a2 100644 --- a/lib/web_ui/test/html/paragraph/text_overflow_golden_test.dart +++ b/lib/web_ui/test/html/paragraph/text_overflow_golden_test.dart @@ -14,7 +14,6 @@ import 'text_goldens.dart'; const String threeLines = 'First\nSecond\nThird'; const String veryLong = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; -const String longUnbreakable = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; void main() { internalBootstrapBrowserTest(() => testMain); diff --git a/lib/web_ui/test/html/path_to_svg_golden_test.dart b/lib/web_ui/test/html/path_to_svg_golden_test.dart index 048803defc5a4..2ed88dfd53d66 100644 --- a/lib/web_ui/test/html/path_to_svg_golden_test.dart +++ b/lib/web_ui/test/html/path_to_svg_golden_test.dart @@ -230,13 +230,4 @@ class ArcSample { clockwise: clockwise); return path; } - - // Returns bounds of start/end point of arc. - Rect getBounds() { - final Offset startP = - Offset(75 - distance + offset.dx, 75 - distance + offset.dy); - final Offset endP = - Offset(75.0 + distance + offset.dx, 75.0 + distance + offset.dy); - return Rect.fromLTRB(startP.dx, startP.dy, endP.dx, endP.dy); - } } diff --git a/lib/web_ui/test/html/text/line_breaker_test.dart b/lib/web_ui/test/html/text/line_breaker_test.dart index 9bb3db9e62ac9..c59063f967e1f 100644 --- a/lib/web_ui/test/html/text/line_breaker_test.dart +++ b/lib/web_ui/test/html/text/line_breaker_test.dart @@ -452,7 +452,6 @@ void testMain() { }, skip: domIntl.v8BreakIterator == null); } -typedef CreateLineBreakFragmenter = LineBreakFragmenter Function(String text); typedef GroupBody = void Function({required bool isV8}); void groupForEachFragmenter(GroupBody callback) { diff --git a/testing/dart/fragment_shader_test.dart b/testing/dart/fragment_shader_test.dart index da34695df7814..7da7dfc2de51c 100644 --- a/testing/dart/fragment_shader_test.dart +++ b/testing/dart/fragment_shader_test.dart @@ -530,8 +530,3 @@ Image _createBlueGreenImageSync() { picture.dispose(); } } - -// Ignore invalid utf8 since file is not actually text. -String readAsStringLossy(File file) { - return convert.utf8.decode(file.readAsBytesSync(), allowMalformed: true); -} diff --git a/testing/dart/image_filter_test.dart b/testing/dart/image_filter_test.dart index 0a79513d99430..44ffece1b7924 100644 --- a/testing/dart/image_filter_test.dart +++ b/testing/dart/image_filter_test.dart @@ -27,13 +27,6 @@ const List grayscaleColorMatrix = [ 0, 0, 0, 1, 0, ]; -const List identityColorMatrix = [ - 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0, -]; - const List constValueColorMatrix = [ 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, diff --git a/testing/dart/plugin_utilities_test.dart b/testing/dart/plugin_utilities_test.dart index 6de841e987b6a..b0a701f0cda2d 100644 --- a/testing/dart/plugin_utilities_test.dart +++ b/testing/dart/plugin_utilities_test.dart @@ -17,8 +17,6 @@ class Foo { double getDouble() => 1.0; } -const Foo foo = Foo(); - void main() { test('PluginUtilities Callback Handles', () { // Top level callback. diff --git a/testing/symbols/verify_exported.dart b/testing/symbols/verify_exported.dart index a4b982171d16e..c29a051220ae3 100644 --- a/testing/symbols/verify_exported.dart +++ b/testing/symbols/verify_exported.dart @@ -194,16 +194,15 @@ int _checkLinux(String outPath, String nmPath, Iterable builds) { } class NmEntry { - NmEntry._(this.address, this.type, this.name); + NmEntry._(this.type, this.name); - final String address; final String type; final String name; static Iterable parse(String stdout) { return LineSplitter.split(stdout).map((String line) { final List parts = line.split(' '); - return NmEntry._(parts[0], parts[1], parts.last); + return NmEntry._(parts[1], parts.last); }); } diff --git a/tools/clang_tidy/test/clang_tidy_test.dart b/tools/clang_tidy/test/clang_tidy_test.dart index 370c989bfa8a7..f50175d5b0bf5 100644 --- a/tools/clang_tidy/test/clang_tidy_test.dart +++ b/tools/clang_tidy/test/clang_tidy_test.dart @@ -32,7 +32,7 @@ final class Fixture { errSink: errBuffer, processManager: processManager, engine: engine, - ), errBuffer, outBuffer); + ), errBuffer); } /// Simulates running the tool with the given [options]. @@ -49,21 +49,17 @@ final class Fixture { outSink: outBuffer, errSink: errBuffer, processManager: processManager, - ), errBuffer, outBuffer); + ), errBuffer); } Fixture._( this.tool, this.errBuffer, - this.outBuffer, ); /// The `clang-tidy` tool. final ClangTidy tool; - /// Captured `stdout` from the tool. - final StringBuffer outBuffer; - /// Captured `stderr` from the tool. final StringBuffer errBuffer; } diff --git a/tools/const_finder/test/const_finder_test.dart b/tools/const_finder/test/const_finder_test.dart index 552c6e7bca691..18e237fd7c96e 100644 --- a/tools/const_finder/test/const_finder_test.dart +++ b/tools/const_finder/test/const_finder_test.dart @@ -45,7 +45,6 @@ void expectInstances(dynamic value, dynamic expected, Compiler compiler) { // This test is assuming the `dart` used to invoke the tests is compatible // with the version of package:kernel in //third-party/dart/pkg/kernel final String dart = Platform.resolvedExecutable; -final String bat = Platform.isWindows ? '.bat' : ''; void _checkRecursion(String dillPath, Compiler compiler) { stdout.writeln('Checking recursive calls.'); diff --git a/tools/const_finder/test/fixtures/lib/box.dart b/tools/const_finder/test/fixtures/lib/box.dart index b9fd42847e513..bc467d14b0f39 100644 --- a/tools/const_finder/test/fixtures/lib/box.dart +++ b/tools/const_finder/test/fixtures/lib/box.dart @@ -10,8 +10,8 @@ class Box { const Box(this.content1, this.content2); - final Object? content1; - final Object? content2; + final Object? content1; // ignore: unreachable_from_main + final Object? content2; // ignore: unreachable_from_main } const Box box1_0 = Box(null, null); diff --git a/tools/const_finder/test/fixtures/lib/static_icon_provider.dart b/tools/const_finder/test/fixtures/lib/static_icon_provider.dart index 8df5feec46127..11840397d889d 100644 --- a/tools/const_finder/test/fixtures/lib/static_icon_provider.dart +++ b/tools/const_finder/test/fixtures/lib/static_icon_provider.dart @@ -19,7 +19,7 @@ Target helper(Target Function(String, int, Target?) tearOff) { class Targets { static const Target used1 = Target('used1', 1, null); static const Target used2 = Target('used2', 2, null); - static const Target unused1 = Target('unused1', 1, null); + static const Target unused1 = Target('unused1', 1, null); // ignore: unreachable_from_main } // const_finder explicitly does not retain constants appearing within a class diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index 4b337033fdf23..c0f7e64837d0a 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -608,24 +608,6 @@ class _RepositoryIcuLicenseFile extends _RepositorySingleLicenseFile { } } -Iterable> splitIntList(List data, int boundary) sync* { - int index = 0; - List getOne() { - final int start = index; - int end = index; - while ((end < data.length) && (data[end] != boundary)) { - end += 1; - } - end += 1; - index = end; - return data.sublist(start, end).toList(); - } - - while (index < data.length) { - yield getOne(); - } -} - class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { _RepositoryCxxStlDualLicenseFile(super.parent, super.io) : _licenses = _parseLicenses(io); diff --git a/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart b/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart index bca022f353a5d..c4048174458b6 100644 --- a/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart +++ b/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart @@ -199,17 +199,14 @@ final class Fixture { verbose: verbose, ), logSink: logSink, - processManager: processManager, ); } const Fixture._({ required this.gitRepo, required this.logSink, - required this.processManager, }); final GitRepo gitRepo; final StringBuffer logSink; - final FakeProcessManager processManager; }