From f5a990257711d75618b30a4a8d5eddfdbbcb2471 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Mon, 6 Apr 2020 22:36:01 +0200 Subject: [PATCH] enable avoid_equals_and_hash_code_on_mutable_classes (#52507) --- analysis_options.yaml | 2 +- dev/bots/analyze.dart | 185 +++++++++--------- dev/bots/test/analyze_test.dart | 6 +- dev/devicelab/test/adb_test.dart | 4 +- .../lib/demo/animation/sections.dart | 1 + .../flutter_gallery/lib/gallery/demo.dart | 3 +- .../flutter_gallery/lib/gallery/demos.dart | 1 + .../flutter_gallery/lib/gallery/options.dart | 3 +- .../flutter_gallery/lib/gallery/scales.dart | 2 + .../localization/localizations_utils.dart | 3 +- dev/tools/vitool/lib/vitool.dart | 3 + .../flutter/lib/src/cupertino/nav_bar.dart | 1 + .../lib/src/gestures/velocity_tracker.dart | 1 + .../lib/src/material/app_bar_theme.dart | 1 + .../lib/src/material/banner_theme.dart | 1 + .../src/material/bottom_app_bar_theme.dart | 1 + .../lib/src/material/bottom_sheet_theme.dart | 1 + .../lib/src/material/button_bar_theme.dart | 1 + .../lib/src/material/button_theme.dart | 1 + .../flutter/lib/src/material/card_theme.dart | 1 + packages/flutter/lib/src/material/chip.dart | 1 + .../flutter/lib/src/material/chip_theme.dart | 1 + .../lib/src/material/dialog_theme.dart | 1 + .../lib/src/material/divider_theme.dart | 1 + .../flutter/lib/src/material/dropdown.dart | 1 + .../floating_action_button_theme.dart | 1 + .../lib/src/material/input_decorator.dart | 3 + .../src/material/navigation_rail_theme.dart | 1 + .../lib/src/material/popup_menu_theme.dart | 1 + .../lib/src/material/slider_theme.dart | 3 + .../lib/src/material/snack_bar_theme.dart | 1 + .../lib/src/material/tab_bar_theme.dart | 1 + .../flutter/lib/src/material/theme_data.dart | 4 +- .../src/material/toggle_buttons_theme.dart | 1 + .../lib/src/material/tooltip_theme.dart | 1 + .../lib/src/painting/_network_image_io.dart | 1 + .../lib/src/painting/_network_image_web.dart | 1 + packages/flutter/lib/src/painting/colors.dart | 1 + .../flutter/lib/src/painting/image_cache.dart | 1 + .../lib/src/painting/image_provider.dart | 4 + .../lib/src/painting/image_resolution.dart | 1 + .../lib/src/services/keyboard_key.dart | 2 + .../lib/src/services/raw_keyboard.dart | 1 + .../lib/src/services/system_chrome.dart | 1 + .../flutter/lib/src/services/text_input.dart | 1 + .../flutter/lib/src/widgets/framework.dart | 4 + .../lib/src/widgets/icon_theme_data.dart | 1 + .../flutter/lib/src/widgets/page_storage.dart | 3 +- .../flutter/lib/src/widgets/shortcuts.dart | 2 + .../lib/src/widgets/widget_inspector.dart | 4 +- .../test/painting/image_provider_test.dart | 2 +- .../test/services/fake_platform_views.dart | 33 +++- .../test/services/platform_views_test.dart | 20 +- .../test/widgets/image_resolution_test.dart | 2 +- packages/flutter/test/widgets/image_test.dart | 1 + packages/flutter/test/widgets/key_test.dart | 1 + .../flutter/test/widgets/shortcuts_test.dart | 3 + .../flutter_driver/lib/src/driver/driver.dart | 1 + packages/flutter_test/test/matchers_test.dart | 17 +- packages/flutter_tools/lib/src/asset.dart | 3 +- .../lib/src/base/fingerprint.dart | 36 ++-- .../flutter_tools/lib/src/base/version.dart | 3 + packages/flutter_tools/lib/src/device.dart | 4 + packages/flutter_tools/lib/src/doctor.dart | 14 +- packages/flutter_tools/lib/src/emulator.dart | 5 +- .../lib/src/ios/ios_emulators.dart | 2 +- .../lib/src/linux/linux_doctor.dart | 4 +- .../lib/src/proxy_validator.dart | 4 +- .../flutter_tools/lib/src/vscode/vscode.dart | 2 +- .../lib/src/web/web_validator.dart | 2 +- .../commands.shard/hermetic/doctor_test.dart | 36 ++-- .../android/android_emulator_test.dart | 2 +- .../general.shard/base/fingerprint_test.dart | 18 +- .../test/general.shard/emulator_test.dart | 10 +- .../linux/linux_doctor_test.dart | 8 +- .../general.shard/web/web_validator_test.dart | 2 +- 76 files changed, 308 insertions(+), 199 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 766969bbdb..213bf942ac 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -59,7 +59,7 @@ linter: - avoid_classes_with_only_static_members # - avoid_double_and_int_checks # only useful when targeting JS runtime - avoid_empty_else - # - avoid_equals_and_hash_code_on_mutable_classes # not yet tested + - avoid_equals_and_hash_code_on_mutable_classes - avoid_field_initializers_in_const_classes - avoid_function_literals_in_foreach_calls # - avoid_implementing_value_types # not yet tested diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index 7a852d96b7..e987a6445b 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -623,8 +623,9 @@ Future verifyNoTrailingSpaces(String workingDirectory, { int minimumMatche exitWithError(problems); } +@immutable class Hash256 { - Hash256(this.a, this.b, this.c, this.d); + const Hash256(this.a, this.b, this.c, this.d); factory Hash256.fromDigest(Digest digest) { assert(digest.bytes.length == 32); @@ -695,92 +696,92 @@ final Set _grandfatheredBinaries = { // packages/flutter_tools/templates/app/android.tmpl/app/src/main/res/mipmap-hdpi/ic_launcher.png // packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/res/mipmap-hdpi/ic_launcher.png // (also used by many examples) - Hash256(0x6A7C8F0D703E3682, 0x108F9662F8133022, 0x36240D3F8F638BB3, 0x91E32BFB96055FEF), + const Hash256(0x6A7C8F0D703E3682, 0x108F9662F8133022, 0x36240D3F8F638BB3, 0x91E32BFB96055FEF), // packages/flutter_tools/templates/app/android.tmpl/app/src/main/res/mipmap-mdpi/ic_launcher.png // (also used by many examples) - Hash256(0xC7C0C0189145E4E3, 0x2A401C61C9BDC615, 0x754B0264E7AFAE24, 0xE834BB81049EAF81), + const Hash256(0xC7C0C0189145E4E3, 0x2A401C61C9BDC615, 0x754B0264E7AFAE24, 0xE834BB81049EAF81), // packages/flutter_tools/templates/app/android.tmpl/app/src/main/res/mipmap-xhdpi/ic_launcher.png // (also used by many examples) - Hash256(0xE14AA40904929BF3, 0x13FDED22CF7E7FFC, 0xBF1D1AAC4263B5EF, 0x1BE8BFCE650397AA), + const Hash256(0xE14AA40904929BF3, 0x13FDED22CF7E7FFC, 0xBF1D1AAC4263B5EF, 0x1BE8BFCE650397AA), // packages/flutter_tools/templates/app/android.tmpl/app/src/main/res/mipmap-xxhdpi/ic_launcher.png // (also used by many examples) - Hash256(0x4D470BF22D5C17D8, 0x4EDC5F82516D1BA8, 0xA1C09559CD761CEF, 0xB792F86D9F52B540), + const Hash256(0x4D470BF22D5C17D8, 0x4EDC5F82516D1BA8, 0xA1C09559CD761CEF, 0xB792F86D9F52B540), // packages/flutter_tools/templates/app/android.tmpl/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png // (also used by many examples) - Hash256(0x3C34E1F298D0C9EA, 0x3455D46DB6B7759C, 0x8211A49E9EC6E44B, 0x635FC5C87DFB4180), + const Hash256(0x3C34E1F298D0C9EA, 0x3455D46DB6B7759C, 0x8211A49E9EC6E44B, 0x635FC5C87DFB4180), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png // (also used by a few examples) - Hash256(0x7770183009E91411, 0x2DE7D8EF1D235A6A, 0x30C5834424858E0D, 0x2F8253F6B8D31926), + const Hash256(0x7770183009E91411, 0x2DE7D8EF1D235A6A, 0x30C5834424858E0D, 0x2F8253F6B8D31926), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png // (also used by many examples) - Hash256(0x5925DAB509451F9E, 0xCBB12CE8A625F9D4, 0xC104718EE20CAFF8, 0xB1B51032D1CD8946), + const Hash256(0x5925DAB509451F9E, 0xCBB12CE8A625F9D4, 0xC104718EE20CAFF8, 0xB1B51032D1CD8946), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png // (also used by many examples) - Hash256(0xC4D9A284C12301D0, 0xF50E248EC53ED51A, 0x19A10147B774B233, 0x08399250B0D44C55), + const Hash256(0xC4D9A284C12301D0, 0xF50E248EC53ED51A, 0x19A10147B774B233, 0x08399250B0D44C55), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png // (also used by many examples) - Hash256(0xBF97F9D3233F33E1, 0x389B09F7B8ADD537, 0x41300CB834D6C7A5, 0xCA32CBED363A4FB2), + const Hash256(0xBF97F9D3233F33E1, 0x389B09F7B8ADD537, 0x41300CB834D6C7A5, 0xCA32CBED363A4FB2), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png // (also used by many examples) - Hash256(0x285442F69A06B45D, 0x9D79DF80321815B5, 0x46473548A37B7881, 0x9B68959C7B8ED237), + const Hash256(0x285442F69A06B45D, 0x9D79DF80321815B5, 0x46473548A37B7881, 0x9B68959C7B8ED237), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png // (also used by many examples) - Hash256(0x2AB64AF8AC727EA9, 0x9C6AB9EAFF847F46, 0xFBF2A9A0A78A0ABC, 0xBF3180F3851645B4), + const Hash256(0x2AB64AF8AC727EA9, 0x9C6AB9EAFF847F46, 0xFBF2A9A0A78A0ABC, 0xBF3180F3851645B4), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png // (also used by many examples) - Hash256(0x9DCA09F4E5ED5684, 0xD3C4DFF41F4E8B7C, 0xB864B438172D72BE, 0x069315FA362930F9), + const Hash256(0x9DCA09F4E5ED5684, 0xD3C4DFF41F4E8B7C, 0xB864B438172D72BE, 0x069315FA362930F9), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png // (also used by many examples) - Hash256(0xD5AD04DE321EF37C, 0xACC5A7B960AFCCE7, 0x1BDCB96FA020C482, 0x49C1545DD1A0F497), + const Hash256(0xD5AD04DE321EF37C, 0xACC5A7B960AFCCE7, 0x1BDCB96FA020C482, 0x49C1545DD1A0F497), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png // (also used by many examples) - Hash256(0x809ABFE75C440770, 0xC13C4E2E46D09603, 0xC22053E9D4E0E227, 0x5DCB9C1DCFBB2C75), + const Hash256(0x809ABFE75C440770, 0xC13C4E2E46D09603, 0xC22053E9D4E0E227, 0x5DCB9C1DCFBB2C75), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png // (also used by many examples) - Hash256(0x3DB08CB79E7B01B9, 0xE81F956E3A0AE101, 0x48D0FAFDE3EA7AA7, 0x0048DF905AA52CFD), + const Hash256(0x3DB08CB79E7B01B9, 0xE81F956E3A0AE101, 0x48D0FAFDE3EA7AA7, 0x0048DF905AA52CFD), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png // (also used by many examples) - Hash256(0x23C13D463F5DCA5C, 0x1F14A14934003601, 0xC29F1218FD461016, 0xD8A22CEF579A665F), + const Hash256(0x23C13D463F5DCA5C, 0x1F14A14934003601, 0xC29F1218FD461016, 0xD8A22CEF579A665F), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png // (also used by many examples) - Hash256(0x6DB7726530D71D3F, 0x52CB59793EB69131, 0x3BAA04796E129E1E, 0x043C0A58A1BFFD2F), + const Hash256(0x6DB7726530D71D3F, 0x52CB59793EB69131, 0x3BAA04796E129E1E, 0x043C0A58A1BFFD2F), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png // (also used by many examples) - Hash256(0xCEE565F5E6211656, 0x9B64980B209FD5CA, 0x4B3D3739011F5343, 0x250B33A1A2C6EB65), + const Hash256(0xCEE565F5E6211656, 0x9B64980B209FD5CA, 0x4B3D3739011F5343, 0x250B33A1A2C6EB65), // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png // packages/flutter_tools/templates/app/ios.tmpl/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png @@ -789,180 +790,180 @@ final Set _grandfatheredBinaries = { // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png // packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png // (also used by many examples) - Hash256(0x93AE7D494FAD0FB3, 0x0CBF3AE746A39C4B, 0xC7A0F8BBF87FBB58, 0x7A3F3C01F3C5CE20), + const Hash256(0x93AE7D494FAD0FB3, 0x0CBF3AE746A39C4B, 0xC7A0F8BBF87FBB58, 0x7A3F3C01F3C5CE20), // packages/flutter_tools/templates/app/macos.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png // (also used by a few examples) - Hash256(0xB18BEBAAD1AD6724, 0xE48BCDF699BA3927, 0xDF3F258FEBE646A3, 0xAB5C62767C6BAB40), + const Hash256(0xB18BEBAAD1AD6724, 0xE48BCDF699BA3927, 0xDF3F258FEBE646A3, 0xAB5C62767C6BAB40), // packages/flutter_tools/templates/app/macos.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png // (also used by a few examples) - Hash256(0xF90D839A289ECADB, 0xF2B0B3400DA43EB8, 0x08B84908335AE4A0, 0x07457C4D5A56A57C), + const Hash256(0xF90D839A289ECADB, 0xF2B0B3400DA43EB8, 0x08B84908335AE4A0, 0x07457C4D5A56A57C), // packages/flutter_tools/templates/app/macos.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png // (also used by a few examples) - Hash256(0x592C2ABF84ADB2D3, 0x91AED8B634D3233E, 0x2C65369F06018DCD, 0x8A4B27BA755EDCBE), + const Hash256(0x592C2ABF84ADB2D3, 0x91AED8B634D3233E, 0x2C65369F06018DCD, 0x8A4B27BA755EDCBE), // packages/flutter_tools/templates/app/macos.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png // (also used by a few examples) - Hash256(0x75D9A0C034113CA8, 0xA1EC11C24B81F208, 0x6630A5A5C65C7D26, 0xA5DC03A1C0A4478C), + const Hash256(0x75D9A0C034113CA8, 0xA1EC11C24B81F208, 0x6630A5A5C65C7D26, 0xA5DC03A1C0A4478C), // packages/flutter_tools/templates/app/macos.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png // (also used by a few examples) - Hash256(0xA896E65745557732, 0xC72BD4EE3A10782F, 0xE2AA95590B5AF659, 0x869E5808DB9C01C1), + const Hash256(0xA896E65745557732, 0xC72BD4EE3A10782F, 0xE2AA95590B5AF659, 0x869E5808DB9C01C1), // packages/flutter_tools/templates/app/macos.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png // (also used by a few examples) - Hash256(0x3A69A8A1AAC5D9A8, 0x374492AF4B6D07A4, 0xCE637659EB24A784, 0x9C4DFB261D75C6A3), + const Hash256(0x3A69A8A1AAC5D9A8, 0x374492AF4B6D07A4, 0xCE637659EB24A784, 0x9C4DFB261D75C6A3), // packages/flutter_tools/templates/app/macos.tmpl/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png // (also used by a few examples) - Hash256(0xD29D4E0AF9256DC9, 0x2D0A8F8810608A5E, 0x64A132AD8B397CA2, 0xC4DDC0B1C26A68C3), + const Hash256(0xD29D4E0AF9256DC9, 0x2D0A8F8810608A5E, 0x64A132AD8B397CA2, 0xC4DDC0B1C26A68C3), // packages/flutter_tools/templates/app/web/icons/Icon-192.png.copy.tmpl // dev/integration_tests/flutter_gallery/web/icons/Icon-192.png - Hash256(0x3DCE99077602F704, 0x21C1C6B2A240BC9B, 0x83D64D86681D45F2, 0x154143310C980BE3), + const Hash256(0x3DCE99077602F704, 0x21C1C6B2A240BC9B, 0x83D64D86681D45F2, 0x154143310C980BE3), // packages/flutter_tools/templates/app/web/icons/Icon-512.png.copy.tmpl // dev/integration_tests/flutter_gallery/web/icons/Icon-512.png - Hash256(0xBACCB205AE45f0B4, 0x21BE1657259B4943, 0xAC40C95094AB877F, 0x3BCBE12CD544DCBE), + const Hash256(0xBACCB205AE45f0B4, 0x21BE1657259B4943, 0xAC40C95094AB877F, 0x3BCBE12CD544DCBE), // packages/flutter_tools/templates/app/web/favicon.png.copy.tmpl // dev/integration_tests/flutter_gallery/web/favicon.png - Hash256(0x7AB2525F4B86B65D, 0x3E4C70358A17E5A1, 0xAAF6F437f99CBCC0, 0x46DAD73d59BB9015), + const Hash256(0x7AB2525F4B86B65D, 0x3E4C70358A17E5A1, 0xAAF6F437f99CBCC0, 0x46DAD73d59BB9015), // GALLERY ICONS // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-hdpi/ic_background.png - Hash256(0x03CFDE53C249475C, 0x277E8B8E90AC8A13, 0xE5FC13C358A94CCB, 0x67CA866C9862A0DD), + const Hash256(0x03CFDE53C249475C, 0x277E8B8E90AC8A13, 0xE5FC13C358A94CCB, 0x67CA866C9862A0DD), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-hdpi/ic_foreground.png - Hash256(0x86A83E23A505EFCC, 0x39C358B699EDE12F, 0xC088EE516A1D0C73, 0xF3B5D74DDAD164B1), + const Hash256(0x86A83E23A505EFCC, 0x39C358B699EDE12F, 0xC088EE516A1D0C73, 0xF3B5D74DDAD164B1), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-hdpi/ic_launcher.png - Hash256(0xD813B1A77320355E, 0xB68C485CD47D0F0F, 0x3C7E1910DCD46F08, 0x60A6401B8DC13647), + const Hash256(0xD813B1A77320355E, 0xB68C485CD47D0F0F, 0x3C7E1910DCD46F08, 0x60A6401B8DC13647), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xhdpi/ic_background.png - Hash256(0x35AFA76BD5D6053F, 0xEE927436C78A8794, 0xA8BA5F5D9FC9653B, 0xE5B96567BB7215ED), + const Hash256(0x35AFA76BD5D6053F, 0xEE927436C78A8794, 0xA8BA5F5D9FC9653B, 0xE5B96567BB7215ED), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xhdpi/ic_foreground.png - Hash256(0x263CE9B4F1F69B43, 0xEBB08AE9FE8F80E7, 0x95647A59EF2C040B, 0xA8AEB246861A7DFF), + const Hash256(0x263CE9B4F1F69B43, 0xEBB08AE9FE8F80E7, 0x95647A59EF2C040B, 0xA8AEB246861A7DFF), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png - Hash256(0x5E1A93C3653BAAFF, 0x1AAC6BCEB8DCBC2F, 0x2AE7D68ECB07E507, 0xCB1FA8354B28313A), + const Hash256(0x5E1A93C3653BAAFF, 0x1AAC6BCEB8DCBC2F, 0x2AE7D68ECB07E507, 0xCB1FA8354B28313A), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xxhdpi/ic_background.png - Hash256(0xA5C77499151DDEC6, 0xDB40D0AC7321FD74, 0x0646C0C0F786743F, 0x8F3C3C408CAC5E8C), + const Hash256(0xA5C77499151DDEC6, 0xDB40D0AC7321FD74, 0x0646C0C0F786743F, 0x8F3C3C408CAC5E8C), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xxhdpi/ic_foreground.png - Hash256(0x33DE450980A2A16B, 0x1982AC7CDC1E7B01, 0x919E07E0289C2139, 0x65F85BCED8895FEF), + const Hash256(0x33DE450980A2A16B, 0x1982AC7CDC1E7B01, 0x919E07E0289C2139, 0x65F85BCED8895FEF), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png - Hash256(0xC3B8577F4A89BA03, 0x830944FB06C3566B, 0x4C99140A2CA52958, 0x089BFDC3079C59B7), + const Hash256(0xC3B8577F4A89BA03, 0x830944FB06C3566B, 0x4C99140A2CA52958, 0x089BFDC3079C59B7), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xxxhdpi/ic_background.png - Hash256(0xDEBC241D6F9C5767, 0x8980FDD46FA7ED0C, 0x5B8ACD26BCC5E1BC, 0x473C89B432D467AD), + const Hash256(0xDEBC241D6F9C5767, 0x8980FDD46FA7ED0C, 0x5B8ACD26BCC5E1BC, 0x473C89B432D467AD), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xxxhdpi/ic_foreground.png - Hash256(0xBEFE5F7E82BF8B64, 0x148D869E3742004B, 0xF821A9F5A1BCDC00, 0x357D246DCC659DC2), + const Hash256(0xBEFE5F7E82BF8B64, 0x148D869E3742004B, 0xF821A9F5A1BCDC00, 0x357D246DCC659DC2), // dev/integration_tests/flutter_gallery/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png - Hash256(0xC385404341FF9EDD, 0x30FBE76F0EC99155, 0x8EA4F4AFE8CC0C60, 0x1CA3EDEF177E1DA8), + const Hash256(0xC385404341FF9EDD, 0x30FBE76F0EC99155, 0x8EA4F4AFE8CC0C60, 0x1CA3EDEF177E1DA8), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-1024.png - Hash256(0x6BE5751A29F57A80, 0x36A4B31CC542C749, 0x984E49B22BD65CAA, 0x75AE8B2440848719), + const Hash256(0x6BE5751A29F57A80, 0x36A4B31CC542C749, 0x984E49B22BD65CAA, 0x75AE8B2440848719), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-120.png - Hash256(0x9972A2264BFA8F8D, 0x964AFE799EADC1FA, 0x2247FB31097F994A, 0x1495DC32DF071793), + const Hash256(0x9972A2264BFA8F8D, 0x964AFE799EADC1FA, 0x2247FB31097F994A, 0x1495DC32DF071793), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-152.png - Hash256(0x4C7CC9B09BEEDA24, 0x45F57D6967753910, 0x57D68E1A6B883D2C, 0x8C52701A74F1400F), + const Hash256(0x4C7CC9B09BEEDA24, 0x45F57D6967753910, 0x57D68E1A6B883D2C, 0x8C52701A74F1400F), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-167.png - Hash256(0x66DACAC1CFE4D349, 0xDBE994CB9125FFD7, 0x2D795CFC9CF9F739, 0xEDBB06CE25082E9C), + const Hash256(0x66DACAC1CFE4D349, 0xDBE994CB9125FFD7, 0x2D795CFC9CF9F739, 0xEDBB06CE25082E9C), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-180.png - Hash256(0x5188621015EBC327, 0xC9EF63AD76E60ECE, 0xE82BDC3E4ABF09E2, 0xEE0139FA7C0A2BE5), + const Hash256(0x5188621015EBC327, 0xC9EF63AD76E60ECE, 0xE82BDC3E4ABF09E2, 0xEE0139FA7C0A2BE5), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-20.png - Hash256(0x27D2752D04EE9A6B, 0x78410E208F74A6CD, 0xC90D9E03B73B8C60, 0xD05F7D623E790487), + const Hash256(0x27D2752D04EE9A6B, 0x78410E208F74A6CD, 0xC90D9E03B73B8C60, 0xD05F7D623E790487), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-29.png - Hash256(0xBB20556B2826CF85, 0xD5BAC73AA69C2AC3, 0x8E71DAD64F15B855, 0xB30CB73E0AF89307), + const Hash256(0xBB20556B2826CF85, 0xD5BAC73AA69C2AC3, 0x8E71DAD64F15B855, 0xB30CB73E0AF89307), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-40.png - Hash256(0x623820FA45CDB0AC, 0x808403E34AD6A53E, 0xA3E9FDAE83EE0931, 0xB020A3A4EF2CDDE7), + const Hash256(0x623820FA45CDB0AC, 0x808403E34AD6A53E, 0xA3E9FDAE83EE0931, 0xB020A3A4EF2CDDE7), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-58.png - Hash256(0xC6D631D1E107215E, 0xD4A58FEC5F3AA4B5, 0x0AE9724E07114C0C, 0x453E5D87C2CAD3B3), + const Hash256(0xC6D631D1E107215E, 0xD4A58FEC5F3AA4B5, 0x0AE9724E07114C0C, 0x453E5D87C2CAD3B3), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-60.png - Hash256(0x4B6F58D1EB8723C6, 0xE717A0D09FEC8806, 0x90C6D1EF4F71836E, 0x618672827979B1A2), + const Hash256(0x4B6F58D1EB8723C6, 0xE717A0D09FEC8806, 0x90C6D1EF4F71836E, 0x618672827979B1A2), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-76.png - Hash256(0x0A1744CC7634D508, 0xE85DD793331F0C8A, 0x0B7C6DDFE0975D8F, 0x29E91C905BBB1BED), + const Hash256(0x0A1744CC7634D508, 0xE85DD793331F0C8A, 0x0B7C6DDFE0975D8F, 0x29E91C905BBB1BED), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-80.png - Hash256(0x24032FBD1E6519D6, 0x0BA93C0D5C189554, 0xF50EAE23756518A2, 0x3FABACF4BD5DAF08), + const Hash256(0x24032FBD1E6519D6, 0x0BA93C0D5C189554, 0xF50EAE23756518A2, 0x3FABACF4BD5DAF08), // dev/integration_tests/flutter_gallery/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-87.png - Hash256(0xC17BAE6DF6BB234A, 0xE0AF4BEB0B805F12, 0x14E74EB7AA9A30F1, 0x5763689165DA7DDF), + const Hash256(0xC17BAE6DF6BB234A, 0xE0AF4BEB0B805F12, 0x14E74EB7AA9A30F1, 0x5763689165DA7DDF), // STOCKS ICONS // dev/benchmarks/test_apps/stocks/android/app/src/main/res/mipmap-hdpi/ic_launcher.png - Hash256(0x74052AB5241D4418, 0x7085180608BC3114, 0xD12493C50CD8BBC7, 0x56DED186C37ACE84), + const Hash256(0x74052AB5241D4418, 0x7085180608BC3114, 0xD12493C50CD8BBC7, 0x56DED186C37ACE84), // dev/benchmarks/test_apps/stocks/android/app/src/main/res/mipmap-mdpi/ic_launcher.png - Hash256(0xE37947332E3491CB, 0x82920EE86A086FEA, 0xE1E0A70B3700A7DA, 0xDCAFBDD8F40E2E19), + const Hash256(0xE37947332E3491CB, 0x82920EE86A086FEA, 0xE1E0A70B3700A7DA, 0xDCAFBDD8F40E2E19), // dev/benchmarks/test_apps/stocks/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png - Hash256(0xE608CDFC0C8579FB, 0xE38873BAAF7BC944, 0x9C9D2EE3685A4FAE, 0x671EF0C8BC41D17C), + const Hash256(0xE608CDFC0C8579FB, 0xE38873BAAF7BC944, 0x9C9D2EE3685A4FAE, 0x671EF0C8BC41D17C), // dev/benchmarks/test_apps/stocks/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png - Hash256(0xBD53D86977DF9C54, 0xF605743C5ABA114C, 0x9D51D1A8BB917E1A, 0x14CAA26C335CAEBD), + const Hash256(0xBD53D86977DF9C54, 0xF605743C5ABA114C, 0x9D51D1A8BB917E1A, 0x14CAA26C335CAEBD), // dev/benchmarks/test_apps/stocks/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png - Hash256(0x64E4D02262C4F3D0, 0xBB4FDC21CD0A816C, 0x4CD2A0194E00FB0F, 0x1C3AE4142FAC0D15), + const Hash256(0x64E4D02262C4F3D0, 0xBB4FDC21CD0A816C, 0x4CD2A0194E00FB0F, 0x1C3AE4142FAC0D15), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png - Hash256(0x5BA3283A76918FC0, 0xEE127D0F22D7A0B6, 0xDF03DAED61669427, 0x93D89DDD87A08117), + const Hash256(0x5BA3283A76918FC0, 0xEE127D0F22D7A0B6, 0xDF03DAED61669427, 0x93D89DDD87A08117), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png - Hash256(0xCD7F26ED31DEA42A, 0x535D155EC6261499, 0x34E6738255FDB2C4, 0xBD8D4BDDE9A99B05), + const Hash256(0xCD7F26ED31DEA42A, 0x535D155EC6261499, 0x34E6738255FDB2C4, 0xBD8D4BDDE9A99B05), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-76.png - Hash256(0x3FA1225FC9A96A7E, 0xCD071BC42881AB0E, 0x7747EB72FFB72459, 0xA37971BBAD27EE24), + const Hash256(0x3FA1225FC9A96A7E, 0xCD071BC42881AB0E, 0x7747EB72FFB72459, 0xA37971BBAD27EE24), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png - Hash256(0xCD867001ACD7BBDB, 0x25CDFD452AE89FA2, 0x8C2DC980CAF55F48, 0x0B16C246CFB389BC), + const Hash256(0xCD867001ACD7BBDB, 0x25CDFD452AE89FA2, 0x8C2DC980CAF55F48, 0x0B16C246CFB389BC), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png - Hash256(0x848E9736E5C4915A, 0x7945BCF6B32FD56B, 0x1F1E7CDDD914352E, 0xC9681D38EF2A70DA), + const Hash256(0x848E9736E5C4915A, 0x7945BCF6B32FD56B, 0x1F1E7CDDD914352E, 0xC9681D38EF2A70DA), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Notification.png - Hash256(0x654BA7D6C4E05CA0, 0x7799878884EF8F11, 0xA383E1F24CEF5568, 0x3C47604A966983C8), + const Hash256(0x654BA7D6C4E05CA0, 0x7799878884EF8F11, 0xA383E1F24CEF5568, 0x3C47604A966983C8), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Small-40.png - Hash256(0x743056FE7D83FE42, 0xA2990825B6AD0415, 0x1AF73D0D43B227AA, 0x07EBEA9B767381D9), + const Hash256(0x743056FE7D83FE42, 0xA2990825B6AD0415, 0x1AF73D0D43B227AA, 0x07EBEA9B767381D9), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png - Hash256(0xA7E1570812D119CF, 0xEF4B602EF28DD0A4, 0x100D066E66F5B9B9, 0x881765DC9303343B), + const Hash256(0xA7E1570812D119CF, 0xEF4B602EF28DD0A4, 0x100D066E66F5B9B9, 0x881765DC9303343B), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png - Hash256(0xB4102839A1E41671, 0x62DACBDEFA471953, 0xB1EE89A0AB7594BE, 0x1D9AC1E67DC2B2CE), + const Hash256(0xB4102839A1E41671, 0x62DACBDEFA471953, 0xB1EE89A0AB7594BE, 0x1D9AC1E67DC2B2CE), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Small.png - Hash256(0x70AC6571B593A967, 0xF1CBAEC9BC02D02D, 0x93AD766D8290ADE6, 0x840139BF9F219019), + const Hash256(0x70AC6571B593A967, 0xF1CBAEC9BC02D02D, 0x93AD766D8290ADE6, 0x840139BF9F219019), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png - Hash256(0x5D87A78386DA2C43, 0xDDA8FEF2CA51438C, 0xE5A276FE28C6CF0A, 0xEBE89085B56665B6), + const Hash256(0x5D87A78386DA2C43, 0xDDA8FEF2CA51438C, 0xE5A276FE28C6CF0A, 0xEBE89085B56665B6), // dev/benchmarks/test_apps/stocks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png - Hash256(0x4D9F5E81F668DA44, 0xB20A77F8BF7BA2E1, 0xF384533B5AD58F07, 0xB3A2F93F8635CD96), + const Hash256(0x4D9F5E81F668DA44, 0xB20A77F8BF7BA2E1, 0xF384533B5AD58F07, 0xB3A2F93F8635CD96), // LEGACY ICONS @@ -971,77 +972,77 @@ final Set _grandfatheredBinaries = { // dev/benchmarks/microbenchmarks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@3x.png // examples/flutter_view/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@3x.png // (not really sure where this came from, or why neither the template nor most examples use them) - Hash256(0x6E645DC9ED913AAD, 0xB50ED29EEB16830D, 0xB32CA12F39121DB9, 0xB7BC1449DDDBF8B8), + const Hash256(0x6E645DC9ED913AAD, 0xB50ED29EEB16830D, 0xB32CA12F39121DB9, 0xB7BC1449DDDBF8B8), // dev/benchmarks/macrobenchmarks/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png // dev/integration_tests/codegen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png // dev/integration_tests/ios_add2app/ios_add2app/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png // dev/integration_tests/release_smoke_test/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png - Hash256(0xDEFAC77E08EC71EC, 0xA04CCA3C95D1FC33, 0xB9F26E1CB15CB051, 0x47DEFC79CDD7C158), + const Hash256(0xDEFAC77E08EC71EC, 0xA04CCA3C95D1FC33, 0xB9F26E1CB15CB051, 0x47DEFC79CDD7C158), // examples/flutter_view/ios/Runner/ic_add.png // examples/platform_view/ios/Runner/ic_add.png - Hash256(0x3CCE7450334675E2, 0xE3AABCA20B028993, 0x127BE82FE0EB3DFF, 0x8B027B3BAF052F2F), + const Hash256(0x3CCE7450334675E2, 0xE3AABCA20B028993, 0x127BE82FE0EB3DFF, 0x8B027B3BAF052F2F), // examples/image_list/images/coast.jpg - Hash256(0xDA957FD30C51B8D2, 0x7D74C2C918692DC4, 0xD3C5C99BB00F0D6B, 0x5EBB30395A6EDE82), + const Hash256(0xDA957FD30C51B8D2, 0x7D74C2C918692DC4, 0xD3C5C99BB00F0D6B, 0x5EBB30395A6EDE82), // examples/image_list/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png - Hash256(0xB5792CA06F48A431, 0xD4379ABA2160BD5D, 0xE92339FC64C6A0D3, 0x417AA359634CD905), + const Hash256(0xB5792CA06F48A431, 0xD4379ABA2160BD5D, 0xE92339FC64C6A0D3, 0x417AA359634CD905), // TEST ASSETS // dev/benchmarks/macrobenchmarks/assets/999x1000.png - Hash256(0x553E9C36DFF3E610, 0x6A608BDE822A0019, 0xDE4F1769B6FBDB97, 0xBC3C20E26B839F59), + const Hash256(0x553E9C36DFF3E610, 0x6A608BDE822A0019, 0xDE4F1769B6FBDB97, 0xBC3C20E26B839F59), // dev/bots/test/analyze-test-input/root/packages/foo/serviceaccount.enc - Hash256(0xA8100AE6AA1940D0, 0xB663BB31CD466142, 0xEBBDBD5187131B92, 0xD93818987832EB89), + const Hash256(0xA8100AE6AA1940D0, 0xB663BB31CD466142, 0xEBBDBD5187131B92, 0xD93818987832EB89), // dev/automated_tests/icon/test.png - Hash256(0xE214B4A0FEEEC6FA, 0x8E7AA8CC9BFBEC40, 0xBCDAC2F2DEBC950F, 0x75AF8EBF02BCE459), + const Hash256(0xE214B4A0FEEEC6FA, 0x8E7AA8CC9BFBEC40, 0xBCDAC2F2DEBC950F, 0x75AF8EBF02BCE459), // dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/android/app/src/main/res/drawable-land-xxhdpi/flutter_splash_screen.png // dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/android/app/src/main/res/mipmap-land-xxhdpi/flutter_splash_screen.png - Hash256(0x2D4F8D7A3DFEF9D3, 0xA0C66938E169AB58, 0x8C6BBBBD1973E34E, 0x03C428416D010182), + const Hash256(0x2D4F8D7A3DFEF9D3, 0xA0C66938E169AB58, 0x8C6BBBBD1973E34E, 0x03C428416D010182), // dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/android/app/src/main/res/drawable-xxhdpi/flutter_splash_screen.png // dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/android/app/src/main/res/mipmap-xxhdpi/flutter_splash_screen.png - Hash256(0xCD46C01BAFA3B243, 0xA6AA1645EEDDE481, 0x143AC8ABAB1A0996, 0x22CAA9D41F74649A), + const Hash256(0xCD46C01BAFA3B243, 0xA6AA1645EEDDE481, 0x143AC8ABAB1A0996, 0x22CAA9D41F74649A), // dev/integration_tests/flutter_driver_screenshot_test/assets/red_square.png - Hash256(0x40054377E1E084F4, 0x4F4410CE8F44C210, 0xABA945DFC55ED0EF, 0x23BDF9469E32F8D3), + const Hash256(0x40054377E1E084F4, 0x4F4410CE8F44C210, 0xABA945DFC55ED0EF, 0x23BDF9469E32F8D3), // dev/integration_tests/flutter_driver_screenshot_test/test_driver/goldens/red_square_image/iPhone7,2.png - Hash256(0x7F9D27C7BC418284, 0x01214E21CA886B2F, 0x40D9DA2B31AE7754, 0x71D68375F9C8A824), + const Hash256(0x7F9D27C7BC418284, 0x01214E21CA886B2F, 0x40D9DA2B31AE7754, 0x71D68375F9C8A824), // examples/flutter_view/assets/flutter-mark-square-64.png // examples/platform_view/assets/flutter-mark-square-64.png - Hash256(0xF416B0D8AC552EC8, 0x819D1F492D1AB5E6, 0xD4F20CF45DB47C22, 0x7BB431FEFB5B67B2), + const Hash256(0xF416B0D8AC552EC8, 0x819D1F492D1AB5E6, 0xD4F20CF45DB47C22, 0x7BB431FEFB5B67B2), // packages/flutter_tools/test/data/intellij/plugins/Dart/lib/Dart.jar - Hash256(0x576E489D788A13DB, 0xBF40E4A39A3DAB37, 0x15CCF0002032E79C, 0xD260C69B29E06646), + const Hash256(0x576E489D788A13DB, 0xBF40E4A39A3DAB37, 0x15CCF0002032E79C, 0xD260C69B29E06646), // packages/flutter_tools/test/data/intellij/plugins/flutter-intellij.jar - Hash256(0x4C67221E25626CB2, 0x3F94E1F49D34E4CF, 0x3A9787A514924FC5, 0x9EF1E143E5BC5690), + const Hash256(0x4C67221E25626CB2, 0x3F94E1F49D34E4CF, 0x3A9787A514924FC5, 0x9EF1E143E5BC5690), // MISCELLANEOUS // dev/bots/serviceaccount.enc - Hash256(0x1F19ADB4D80AFE8C, 0xE61899BA776B1A8D, 0xCA398C75F5F7050D, 0xFB0E72D7FBBBA69B), + const Hash256(0x1F19ADB4D80AFE8C, 0xE61899BA776B1A8D, 0xCA398C75F5F7050D, 0xFB0E72D7FBBBA69B), // dev/docs/favicon.ico - Hash256(0x67368CA1733E933A, 0xCA3BC56EF0695012, 0xE862C371AD4412F0, 0x3EC396039C609965), + const Hash256(0x67368CA1733E933A, 0xCA3BC56EF0695012, 0xE862C371AD4412F0, 0x3EC396039C609965), // dev/snippets/assets/code_sample.png - Hash256(0xAB2211A47BDA001D, 0x173A52FD9C75EBC7, 0xE158942FFA8243AD, 0x2A148871990D4297), + const Hash256(0xAB2211A47BDA001D, 0x173A52FD9C75EBC7, 0xE158942FFA8243AD, 0x2A148871990D4297), // dev/snippets/assets/code_snippet.png - Hash256(0xDEC70574DA46DFBB, 0xFA657A771F3E1FBD, 0xB265CFC6B2AA5FE3, 0x93BA4F325D1520BA), + const Hash256(0xDEC70574DA46DFBB, 0xFA657A771F3E1FBD, 0xB265CFC6B2AA5FE3, 0x93BA4F325D1520BA), // packages/flutter_tools/static/Ahem.ttf - Hash256(0x63D2ABD0041C3E3B, 0x4B52AD8D382353B5, 0x3C51C6785E76CE56, 0xED9DACAD2D2E31C4), + const Hash256(0x63D2ABD0041C3E3B, 0x4B52AD8D382353B5, 0x3C51C6785E76CE56, 0xED9DACAD2D2E31C4), }; Future verifyNoBinaries(String workingDirectory, { Set grandfatheredBinaries }) async { diff --git a/dev/bots/test/analyze_test.dart b/dev/bots/test/analyze_test.dart index 5b12713673..cc34b852ff 100644 --- a/dev/bots/test/analyze_test.dart +++ b/dev/bots/test/analyze_test.dart @@ -95,7 +95,7 @@ void main() { test('analyze.dart - verifyNoBinaries - positive', () async { final String result = await capture(() => verifyNoBinaries( testRootPath, - grandfatheredBinaries: {Hash256(0x39A050CD69434936, 0, 0, 0)}, + grandfatheredBinaries: {const Hash256(0x39A050CD69434936, 0, 0, 0)}, ), exitCode: Platform.isWindows ? 0 : 1); if (!Platform.isWindows) { // The output starts with the call to git ls-files, the details of which @@ -117,8 +117,8 @@ void main() { await capture(() => verifyNoBinaries( testRootPath, grandfatheredBinaries: { - Hash256(0xA8100AE6AA1940D0, 0xB663BB31CD466142, 0xEBBDBD5187131B92, 0xD93818987832EB89), // sha256("\xff") - Hash256(0x155644D3F13D98BF, 0, 0, 0), + const Hash256(0xA8100AE6AA1940D0, 0xB663BB31CD466142, 0xEBBDBD5187131B92, 0xD93818987832EB89), // sha256("\xff") + const Hash256(0x155644D3F13D98BF, 0, 0, 0), }, ), exitCode: 0); }); diff --git a/dev/devicelab/test/adb_test.dart b/dev/devicelab/test/adb_test.dart index ddf02793f8..fe68bfd340 100644 --- a/dev/devicelab/test/adb_test.dart +++ b/dev/devicelab/test/adb_test.dart @@ -7,6 +7,7 @@ import 'dart:async'; import 'package:collection/collection.dart' show ListEquality, MapEquality; import 'package:flutter_devicelab/framework/adb.dart'; +import 'package:meta/meta.dart'; import 'common.dart'; @@ -124,8 +125,9 @@ CommandArgs cmd({ typedef ExitErrorFactory = dynamic Function(); +@immutable class CommandArgs { - CommandArgs({ this.command, this.arguments, this.environment }); + const CommandArgs({ this.command, this.arguments, this.environment }); final String command; final List arguments; diff --git a/dev/integration_tests/flutter_gallery/lib/demo/animation/sections.dart b/dev/integration_tests/flutter_gallery/lib/demo/animation/sections.dart index fa356c4e6e..9ff1f1cb7a 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/animation/sections.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/animation/sections.dart @@ -26,6 +26,7 @@ class SectionDetail { final String imageAssetPackage; } +@immutable class Section { const Section({ this.title, diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart b/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart index e7cda5537d..b00b663fbc 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart @@ -12,8 +12,9 @@ import 'demos.dart'; import 'example_code_parser.dart'; import 'syntax_highlighter.dart'; +@immutable class ComponentDemoTabData { - ComponentDemoTabData({ + const ComponentDemoTabData({ this.demoWidget, this.exampleCodeTag, this.description, diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart b/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart index 3b1c72255f..5f8eec6e25 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import '../demo/all.dart'; import 'icons.dart'; +@immutable class GalleryDemoCategory { const GalleryDemoCategory._({ @required this.name, diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/options.dart b/dev/integration_tests/flutter_gallery/lib/gallery/options.dart index 2f7337cb36..cc84c731cf 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/options.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/options.dart @@ -7,8 +7,9 @@ import 'package:flutter/material.dart'; import 'about.dart'; import 'scales.dart'; +@immutable class GalleryOptions { - GalleryOptions({ + const GalleryOptions({ this.themeMode, this.textScaleFactor, this.visualDensity, diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart b/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart index 2554a8f194..bf32601282 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; +@immutable class GalleryTextScaleValue { const GalleryTextScaleValue(this.scale, this.label); @@ -37,6 +38,7 @@ const List kAllGalleryTextScaleValues = { - LocaleInfo({ + const LocaleInfo({ this.languageCode, this.scriptCode, this.countryCode, diff --git a/dev/tools/vitool/lib/vitool.dart b/dev/tools/vitool/lib/vitool.dart index 9045efc3af..f18739c4f3 100644 --- a/dev/tools/vitool/lib/vitool.dart +++ b/dev/tools/vitool/lib/vitool.dart @@ -260,6 +260,7 @@ List> parsePoints(String points) { } /// Data for a single animation frame. +@immutable class FrameData { const FrameData(this.size, this.paths); @@ -285,6 +286,7 @@ class FrameData { } /// Represents an SVG path element. +@immutable class SvgPath { const SvgPath(this.id, this.commands, {this.opacity = 1.0}); @@ -348,6 +350,7 @@ class SvgPath { /// * "Z" => SvgPathCommand('Z', []) /// * "C 1.0, 1.0 2.0, 2.0 3.0, 3.0" SvgPathCommand('C', [Point(1.0, 1.0), /// Point(2.0, 2.0), Point(3.0, 3.0)]) +@immutable class SvgPathCommand { const SvgPathCommand(this.type, this.points); diff --git a/packages/flutter/lib/src/cupertino/nav_bar.dart b/packages/flutter/lib/src/cupertino/nav_bar.dart index 3b49be9356..504d5477bc 100644 --- a/packages/flutter/lib/src/cupertino/nav_bar.dart +++ b/packages/flutter/lib/src/cupertino/nav_bar.dart @@ -52,6 +52,7 @@ const Border _kDefaultNavBarBorder = Border( // all transition between each other (per Navigator) via Hero transitions. const _HeroTag _defaultHeroTag = _HeroTag(null); +@immutable class _HeroTag { const _HeroTag(this.navigator); diff --git a/packages/flutter/lib/src/gestures/velocity_tracker.dart b/packages/flutter/lib/src/gestures/velocity_tracker.dart index 34d02474c3..a1ae2d2cc3 100644 --- a/packages/flutter/lib/src/gestures/velocity_tracker.dart +++ b/packages/flutter/lib/src/gestures/velocity_tracker.dart @@ -11,6 +11,7 @@ import 'lsq_solver.dart'; export 'dart:ui' show Offset; /// A velocity in two dimensions. +@immutable class Velocity { /// Creates a velocity. /// diff --git a/packages/flutter/lib/src/material/app_bar_theme.dart b/packages/flutter/lib/src/material/app_bar_theme.dart index 25e474cf5e..308e394973 100644 --- a/packages/flutter/lib/src/material/app_bar_theme.dart +++ b/packages/flutter/lib/src/material/app_bar_theme.dart @@ -27,6 +27,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class AppBarTheme with Diagnosticable { /// Creates a theme that can be used for [ThemeData.AppBarTheme]. const AppBarTheme({ diff --git a/packages/flutter/lib/src/material/banner_theme.dart b/packages/flutter/lib/src/material/banner_theme.dart index 5ca4c6837d..798e7e3443 100644 --- a/packages/flutter/lib/src/material/banner_theme.dart +++ b/packages/flutter/lib/src/material/banner_theme.dart @@ -23,6 +23,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class MaterialBannerThemeData with Diagnosticable { /// Creates a theme that can be used for [MaterialBannerTheme] or diff --git a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart index 18d8461f47..3e2b310a02 100644 --- a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart +++ b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart @@ -25,6 +25,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class BottomAppBarTheme with Diagnosticable { /// Creates a theme that can be used for [ThemeData.BottomAppBarTheme]. const BottomAppBarTheme({ diff --git a/packages/flutter/lib/src/material/bottom_sheet_theme.dart b/packages/flutter/lib/src/material/bottom_sheet_theme.dart index c2ccf24977..44ffee17bd 100644 --- a/packages/flutter/lib/src/material/bottom_sheet_theme.dart +++ b/packages/flutter/lib/src/material/bottom_sheet_theme.dart @@ -24,6 +24,7 @@ import 'package:flutter/rendering.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class BottomSheetThemeData with Diagnosticable { /// Creates a theme that can be used for [ThemeData.bottomSheetTheme]. const BottomSheetThemeData({ diff --git a/packages/flutter/lib/src/material/button_bar_theme.dart b/packages/flutter/lib/src/material/button_bar_theme.dart index 1f8772834d..86f7394b3a 100644 --- a/packages/flutter/lib/src/material/button_bar_theme.dart +++ b/packages/flutter/lib/src/material/button_bar_theme.dart @@ -24,6 +24,7 @@ import 'theme.dart'; /// its subtree. /// * [ButtonBar], which uses this to configure itself and its children /// button widgets. +@immutable class ButtonBarThemeData with Diagnosticable { /// Constructs the set of properties used to configure [ButtonBar] widgets. /// diff --git a/packages/flutter/lib/src/material/button_theme.dart b/packages/flutter/lib/src/material/button_theme.dart index 3c61054c6e..f7dc177583 100644 --- a/packages/flutter/lib/src/material/button_theme.dart +++ b/packages/flutter/lib/src/material/button_theme.dart @@ -248,6 +248,7 @@ class ButtonTheme extends InheritedTheme { /// A button theme can be specified as part of the overall Material theme /// using [ThemeData.buttonTheme]. The Material theme's button theme data /// can be overridden with [ButtonTheme]. +@immutable class ButtonThemeData with Diagnosticable { /// Create a button theme object that can be used with [ButtonTheme] /// or [ThemeData]. diff --git a/packages/flutter/lib/src/material/card_theme.dart b/packages/flutter/lib/src/material/card_theme.dart index 7c6da59d8e..0ab3827853 100644 --- a/packages/flutter/lib/src/material/card_theme.dart +++ b/packages/flutter/lib/src/material/card_theme.dart @@ -26,6 +26,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class CardTheme with Diagnosticable { /// Creates a theme that can be used for [ThemeData.cardTheme]. diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 022c2d47d3..05bcabe3e7 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -2157,6 +2157,7 @@ class _RenderChipElement extends RenderObjectElement { } } +@immutable class _ChipRenderTheme { const _ChipRenderTheme({ @required this.avatar, diff --git a/packages/flutter/lib/src/material/chip_theme.dart b/packages/flutter/lib/src/material/chip_theme.dart index 527e29ac88..75013669ee 100644 --- a/packages/flutter/lib/src/material/chip_theme.dart +++ b/packages/flutter/lib/src/material/chip_theme.dart @@ -168,6 +168,7 @@ class ChipTheme extends InheritedTheme { /// * [Theme] widget, which performs a similar function to [ChipTheme], /// but for overall themes. /// * [ThemeData], which has a default [ChipThemeData]. +@immutable class ChipThemeData with Diagnosticable { /// Create a [ChipThemeData] given a set of exact values. All the values /// must be specified except for [shadowColor], [selectedShadowColor], diff --git a/packages/flutter/lib/src/material/dialog_theme.dart b/packages/flutter/lib/src/material/dialog_theme.dart index 62bbdb4e39..72d10bc40a 100644 --- a/packages/flutter/lib/src/material/dialog_theme.dart +++ b/packages/flutter/lib/src/material/dialog_theme.dart @@ -27,6 +27,7 @@ import 'theme.dart'; /// * [Dialog], a material dialog that can be customized using this [DialogTheme]. /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class DialogTheme with Diagnosticable { /// Creates a dialog theme that can be used for [ThemeData.dialogTheme]. const DialogTheme({ diff --git a/packages/flutter/lib/src/material/divider_theme.dart b/packages/flutter/lib/src/material/divider_theme.dart index 53d53ad3e7..a99f52615a 100644 --- a/packages/flutter/lib/src/material/divider_theme.dart +++ b/packages/flutter/lib/src/material/divider_theme.dart @@ -26,6 +26,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class DividerThemeData with Diagnosticable { /// Creates a theme that can be used for [DividerTheme] or diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index fe22689fde..c81ab8673d 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -368,6 +368,7 @@ class _DropdownMenuRouteLayout extends SingleChildLayoutDelegate { // We box the return value so that the return value can be null. Otherwise, // canceling the route (which returns null) would get confused with actually // returning a real null value. +@immutable class _DropdownRouteResult { const _DropdownRouteResult(this.result); diff --git a/packages/flutter/lib/src/material/floating_action_button_theme.dart b/packages/flutter/lib/src/material/floating_action_button_theme.dart index 89eca9ad40..0361af7c5a 100644 --- a/packages/flutter/lib/src/material/floating_action_button_theme.dart +++ b/packages/flutter/lib/src/material/floating_action_button_theme.dart @@ -26,6 +26,7 @@ import 'package:flutter/rendering.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class FloatingActionButtonThemeData with Diagnosticable { /// Creates a theme that can be used for /// [ThemeData.floatingActionButtonTheme]. diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index dc346ffbb2..40f6ad6268 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -40,6 +40,7 @@ class _InputBorderGap extends ChangeNotifier { } @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes, this class is not used in collection bool operator ==(Object other) { if (identical(this, other)) return true; @@ -51,6 +52,7 @@ class _InputBorderGap extends ChangeNotifier { } @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes, this class is not used in collection int get hashCode => hashValues(start, extent); } @@ -489,6 +491,7 @@ enum _DecorationSlot { } // An analog of InputDecoration for the _Decorator widget. +@immutable class _Decoration { const _Decoration({ @required this.contentPadding, diff --git a/packages/flutter/lib/src/material/navigation_rail_theme.dart b/packages/flutter/lib/src/material/navigation_rail_theme.dart index 8c2b7c76c6..470c8d7ca1 100644 --- a/packages/flutter/lib/src/material/navigation_rail_theme.dart +++ b/packages/flutter/lib/src/material/navigation_rail_theme.dart @@ -33,6 +33,7 @@ import 'theme_data.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class NavigationRailThemeData with Diagnosticable { /// Creates a theme that can be used for [ThemeData.navigationRailTheme]. const NavigationRailThemeData({ diff --git a/packages/flutter/lib/src/material/popup_menu_theme.dart b/packages/flutter/lib/src/material/popup_menu_theme.dart index 83a33f9a8d..875532ea98 100644 --- a/packages/flutter/lib/src/material/popup_menu_theme.dart +++ b/packages/flutter/lib/src/material/popup_menu_theme.dart @@ -29,6 +29,7 @@ import 'theme.dart'; /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class PopupMenuThemeData with Diagnosticable { /// Creates the set of properties used to configure [PopupMenuTheme]. const PopupMenuThemeData({ diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index c9579d81f1..bf306e6d24 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -305,6 +305,7 @@ enum Thumb { /// {@macro flutter.material.slider.seeAlso.rangeSliderValueIndicatorShape} /// {@macro flutter.material.slider.seeAlso.rangeSliderTrackShape} /// {@macro flutter.material.slider.seeAlso.rangeSliderTickMarkShape} +@immutable class SliderThemeData with Diagnosticable { /// Create a [SliderThemeData] given a set of exact values. All the values /// must be specified. @@ -2866,6 +2867,7 @@ typedef RangeThumbSelector = Thumb Function( /// This object is passed into [RangeSlider.values] to set its values, and it /// is emitted in [RangeSlider.onChange], [RangeSlider.onChangeStart], and /// [RangeSlider.onChangeEnd] when the values change. +@immutable class RangeValues { /// Creates pair of start and end values. const RangeValues(this.start, this.end); @@ -2905,6 +2907,7 @@ class RangeValues { /// /// Used in combination with [RangeSlider.showValueIndicator] to display /// labels above the thumbs. +@immutable class RangeLabels { /// Creates pair of start and end labels. const RangeLabels(this.start, this.end); diff --git a/packages/flutter/lib/src/material/snack_bar_theme.dart b/packages/flutter/lib/src/material/snack_bar_theme.dart index e05916b3d9..a771254a6e 100644 --- a/packages/flutter/lib/src/material/snack_bar_theme.dart +++ b/packages/flutter/lib/src/material/snack_bar_theme.dart @@ -46,6 +46,7 @@ enum SnackBarBehavior { /// /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class SnackBarThemeData with Diagnosticable { /// Creates a theme that can be used for [ThemeData.snackBarTheme]. diff --git a/packages/flutter/lib/src/material/tab_bar_theme.dart b/packages/flutter/lib/src/material/tab_bar_theme.dart index b6bbf597d0..e50f6c8ac1 100644 --- a/packages/flutter/lib/src/material/tab_bar_theme.dart +++ b/packages/flutter/lib/src/material/tab_bar_theme.dart @@ -23,6 +23,7 @@ import 'theme.dart'; /// * [TabBar], a widget that displays a horizontal row of tabs. /// * [ThemeData], which describes the overall theme information for the /// application. +@immutable class TabBarTheme with Diagnosticable { /// Creates a tab bar theme that can be used with [ThemeData.tabBarTheme]. const TabBarTheme({ diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 3d98277b6c..19cf5286ef 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -1636,8 +1636,9 @@ class MaterialBasedCupertinoThemeData extends CupertinoThemeData { } } +@immutable class _IdentityThemeDataCacheKey { - _IdentityThemeDataCacheKey(this.baseTheme, this.localTextGeometry); + const _IdentityThemeDataCacheKey(this.baseTheme, this.localTextGeometry); final ThemeData baseTheme; final TextTheme localTextGeometry; @@ -1713,6 +1714,7 @@ class _FifoCache { /// * [ThemeData.visualDensity], where this property is used to specify the base /// horizontal density of Material components. /// * [Material design guidance on density](https://material.io/design/layout/applying-density.html). +@immutable class VisualDensity with Diagnosticable { /// A const constructor for [VisualDensity]. /// diff --git a/packages/flutter/lib/src/material/toggle_buttons_theme.dart b/packages/flutter/lib/src/material/toggle_buttons_theme.dart index 2874dbd7d1..bbb62e1b76 100644 --- a/packages/flutter/lib/src/material/toggle_buttons_theme.dart +++ b/packages/flutter/lib/src/material/toggle_buttons_theme.dart @@ -24,6 +24,7 @@ import 'theme.dart'; /// /// * [ToggleButtonsTheme], which describes the actual configuration of a /// toggle buttons theme. +@immutable class ToggleButtonsThemeData with Diagnosticable { /// Creates the set of color and border properties used to configure /// [ToggleButtons]. diff --git a/packages/flutter/lib/src/material/tooltip_theme.dart b/packages/flutter/lib/src/material/tooltip_theme.dart index f3bfd9e1fa..1846287797 100644 --- a/packages/flutter/lib/src/material/tooltip_theme.dart +++ b/packages/flutter/lib/src/material/tooltip_theme.dart @@ -23,6 +23,7 @@ import 'theme.dart'; /// subtree. /// * [TooltipThemeData], which describes the actual configuration of a /// tooltip theme. +@immutable class TooltipThemeData with Diagnosticable { /// Creates the set of properties used to configure [Tooltip]s. const TooltipThemeData({ diff --git a/packages/flutter/lib/src/painting/_network_image_io.dart b/packages/flutter/lib/src/painting/_network_image_io.dart index 5eaf04518d..9a139912d2 100644 --- a/packages/flutter/lib/src/painting/_network_image_io.dart +++ b/packages/flutter/lib/src/painting/_network_image_io.dart @@ -15,6 +15,7 @@ import 'image_provider.dart' as image_provider; import 'image_stream.dart'; /// The dart:io implementation of [image_provider.NetworkImage]. +@immutable class NetworkImage extends image_provider.ImageProvider implements image_provider.NetworkImage { /// Creates an object that fetches the image at the given URL. /// diff --git a/packages/flutter/lib/src/painting/_network_image_web.dart b/packages/flutter/lib/src/painting/_network_image_web.dart index 2e9771b50f..99fe45afff 100644 --- a/packages/flutter/lib/src/painting/_network_image_web.dart +++ b/packages/flutter/lib/src/painting/_network_image_web.dart @@ -13,6 +13,7 @@ import 'image_stream.dart'; /// The dart:html implementation of [image_provider.NetworkImage]. /// /// NetworkImage on the web does not support decoding to a specified size. +@immutable class NetworkImage extends image_provider.ImageProvider implements image_provider.NetworkImage { diff --git a/packages/flutter/lib/src/painting/colors.dart b/packages/flutter/lib/src/painting/colors.dart index cdb82edf5c..08d75ad5ff 100644 --- a/packages/flutter/lib/src/painting/colors.dart +++ b/packages/flutter/lib/src/painting/colors.dart @@ -425,6 +425,7 @@ class HSLColor { /// primary and accent color swatches. /// * [material.Colors], which defines all of the standard material design /// colors. +@immutable class ColorSwatch extends Color { /// Creates a color that has a small table of related colors called a "swatch". /// diff --git a/packages/flutter/lib/src/painting/image_cache.dart b/packages/flutter/lib/src/painting/image_cache.dart index 508b88aadb..24d894f45b 100644 --- a/packages/flutter/lib/src/painting/image_cache.dart +++ b/packages/flutter/lib/src/painting/image_cache.dart @@ -530,6 +530,7 @@ class ImageCache { /// /// To obtain an [ImageCacheStatus], use [ImageCache.statusForKey] or /// [ImageProvider.obtainCacheStatus]. +@immutable class ImageCacheStatus { const ImageCacheStatus._({ this.pending = false, diff --git a/packages/flutter/lib/src/painting/image_provider.dart b/packages/flutter/lib/src/painting/image_provider.dart index 1a3ac3f841..e75a5820f5 100644 --- a/packages/flutter/lib/src/painting/image_provider.dart +++ b/packages/flutter/lib/src/painting/image_provider.dart @@ -674,6 +674,7 @@ abstract class AssetBundleImageProvider extends ImageProvider { /// See also: /// /// * [Image.file] for a shorthand of an [Image] widget backed by [FileImage]. +@immutable class FileImage extends ImageProvider { /// Creates an object that decodes a [File] as an image. /// @@ -890,6 +892,7 @@ class FileImage extends ImageProvider { /// See also: /// /// * [Image.memory] for a shorthand of an [Image] widget backed by [MemoryImage]. +@immutable class MemoryImage extends ImageProvider { /// Creates an object that decodes a [Uint8List] buffer as an image. /// @@ -1008,6 +1011,7 @@ class MemoryImage extends ImageProvider { /// /// * [Image.asset] for a shorthand of an [Image] widget backed by /// [ExactAssetImage] when using a scale. +@immutable class ExactAssetImage extends AssetBundleImageProvider { /// Creates an object that fetches the given image from an asset bundle. /// diff --git a/packages/flutter/lib/src/painting/image_resolution.dart b/packages/flutter/lib/src/painting/image_resolution.dart index eb310b4da5..172d63596a 100644 --- a/packages/flutter/lib/src/painting/image_resolution.dart +++ b/packages/flutter/lib/src/painting/image_resolution.dart @@ -120,6 +120,7 @@ const String _kAssetManifestFileName = 'AssetManifest.json'; /// /// * [Image.asset] for a shorthand of an [Image] widget backed by [AssetImage] /// when used without a scale. +@immutable class AssetImage extends AssetBundleImageProvider { /// Creates an object that fetches an image from an asset bundle. /// diff --git a/packages/flutter/lib/src/services/keyboard_key.dart b/packages/flutter/lib/src/services/keyboard_key.dart index 82a6def358..efd28005a4 100644 --- a/packages/flutter/lib/src/services/keyboard_key.dart +++ b/packages/flutter/lib/src/services/keyboard_key.dart @@ -121,6 +121,7 @@ abstract class KeyboardKey with Diagnosticable { /// to keyboard events. /// * [RawKeyboardListener], a widget used to listen to and supply handlers for /// keyboard events. +@immutable class LogicalKeyboardKey extends KeyboardKey { /// Creates a LogicalKeyboardKey object with an optional key label and debug /// name. @@ -2043,6 +2044,7 @@ class LogicalKeyboardKey extends KeyboardKey { /// to keyboard events. /// * [RawKeyboardListener], a widget used to listen to and supply handlers for /// keyboard events. +@immutable class PhysicalKeyboardKey extends KeyboardKey { /// Creates a PhysicalKeyboardKey object with an optional debug name. /// diff --git a/packages/flutter/lib/src/services/raw_keyboard.dart b/packages/flutter/lib/src/services/raw_keyboard.dart index 83136d1a23..d42471ead3 100644 --- a/packages/flutter/lib/src/services/raw_keyboard.dart +++ b/packages/flutter/lib/src/services/raw_keyboard.dart @@ -623,6 +623,7 @@ class RawKeyboard { void clearKeysPressed() => _keysPressed.clear(); } +@immutable class _ModifierSidePair extends Object { const _ModifierSidePair(this.modifier, this.side); diff --git a/packages/flutter/lib/src/services/system_chrome.dart b/packages/flutter/lib/src/services/system_chrome.dart index bf60574b5e..d7debe8b40 100644 --- a/packages/flutter/lib/src/services/system_chrome.dart +++ b/packages/flutter/lib/src/services/system_chrome.dart @@ -83,6 +83,7 @@ enum SystemUiOverlay { /// Specifies a preference for the style of the system overlays. /// /// Used by [SystemChrome.setSystemUIOverlayStyle]. +@immutable class SystemUiOverlayStyle { /// Creates a new [SystemUiOverlayStyle]. const SystemUiOverlayStyle({ diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index cb50d23c15..88681c1b9e 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -82,6 +82,7 @@ enum SmartQuotesType { /// This class stays as close to [Enum] interface as possible, and allows /// for additional flags for some input types. For example, numeric input /// can specify whether it supports decimal numbers and/or signed numbers. +@immutable class TextInputType { const TextInputType._(this.index) : signed = null, diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index ed2325a5e6..39659862f4 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -2887,7 +2887,9 @@ abstract class Element extends DiagnosticableTree implements BuildContext { // Custom implementation of `operator ==` optimized for the ".of" pattern // used with `InheritedWidgets`. + @nonVirtual @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) => identical(this, other); // Custom implementation of hash code optimized for the ".of" pattern used @@ -2904,7 +2906,9 @@ abstract class Element extends DiagnosticableTree implements BuildContext { // // * https://dart.dev/articles/dart-vm/numeric-computation, which // explains how numbers are represented in Dart. + @nonVirtual @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _cachedHash; final int _cachedHash = _nextHashCode = (_nextHashCode + 1) % 0xffffff; static int _nextHashCode = 1; diff --git a/packages/flutter/lib/src/widgets/icon_theme_data.dart b/packages/flutter/lib/src/widgets/icon_theme_data.dart index fbca5b2413..d18d8ffd6e 100644 --- a/packages/flutter/lib/src/widgets/icon_theme_data.dart +++ b/packages/flutter/lib/src/widgets/icon_theme_data.dart @@ -18,6 +18,7 @@ import 'framework.dart' show BuildContext; /// To obtain the current icon theme, use [IconTheme.of]. To convert an icon /// theme to a version with all the fields filled in, use [new /// IconThemeData.fallback]. +@immutable class IconThemeData with Diagnosticable { /// Creates an icon theme data. /// diff --git a/packages/flutter/lib/src/widgets/page_storage.dart b/packages/flutter/lib/src/widgets/page_storage.dart index eab078de43..c242059d23 100644 --- a/packages/flutter/lib/src/widgets/page_storage.dart +++ b/packages/flutter/lib/src/widgets/page_storage.dart @@ -38,8 +38,9 @@ class PageStorageKey extends ValueKey { const PageStorageKey(T value) : super(value); } +@immutable class _StorageEntryIdentifier { - _StorageEntryIdentifier(this.keys) + const _StorageEntryIdentifier(this.keys) : assert(keys != null); final List> keys; diff --git a/packages/flutter/lib/src/widgets/shortcuts.dart b/packages/flutter/lib/src/widgets/shortcuts.dart index df92ebf350..879b4657e8 100644 --- a/packages/flutter/lib/src/widgets/shortcuts.dart +++ b/packages/flutter/lib/src/widgets/shortcuts.dart @@ -82,6 +82,7 @@ class KeySet { final HashSet _keys; @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes, to remove in NNBD with a late final hashcode bool operator ==(Object other) { if (other.runtimeType != runtimeType) { return false; @@ -99,6 +100,7 @@ class KeySet { int _hashCode; @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes, to remove in NNBD with a late final hashcode int get hashCode { // Return cached hash code if available. if (_hashCode != null) { diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 4d021afd80..3e17698d0e 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -2426,6 +2426,7 @@ class _RenderInspectorOverlay extends RenderBox { } } +@immutable class _TransformedRect { _TransformedRect(RenderObject object) : rect = object.semanticBounds, @@ -2451,8 +2452,9 @@ class _TransformedRect { /// /// The equality operator can be used to determine whether the overlay needs to /// be rendered again. +@immutable class _InspectorOverlayRenderState { - _InspectorOverlayRenderState({ + const _InspectorOverlayRenderState({ @required this.overlayRect, @required this.selected, @required this.candidates, diff --git a/packages/flutter/test/painting/image_provider_test.dart b/packages/flutter/test/painting/image_provider_test.dart index 37b301cc16..1a0b546718 100644 --- a/packages/flutter/test/painting/image_provider_test.dart +++ b/packages/flutter/test/painting/image_provider_test.dart @@ -553,7 +553,7 @@ Future _resolveAndGetSize(ImageProvider imageProvider, // This version of MemoryImage guarantees obtainKey returns a future that has not been // completed synchronously. class AsyncKeyMemoryImage extends MemoryImage { - AsyncKeyMemoryImage(Uint8List bytes) : super(bytes); + const AsyncKeyMemoryImage(Uint8List bytes) : super(bytes); @override Future obtainKey(ImageConfiguration configuration) { diff --git a/packages/flutter/test/services/fake_platform_views.dart b/packages/flutter/test/services/fake_platform_views.dart index c08d359a9b..f70bca420b 100644 --- a/packages/flutter/test/services/fake_platform_views.dart +++ b/packages/flutter/test/services/fake_platform_views.dart @@ -157,7 +157,7 @@ class FakeAndroidPlatformViewsController { if (resizeCompleter != null) { await resizeCompleter.future; } - _views[id].size = Size(width, height); + _views[id] = _views[id].copyWith(size: Size(width, height)); return Future.sync(() => null); } @@ -195,7 +195,7 @@ class FakeAndroidPlatformViewsController { message: 'Trying to resize a platform view with unknown id: $id', ); - _views[id].layoutDirection = layoutDirection; + _views[id] = _views[id].copyWith(layoutDirection: layoutDirection); return Future.sync(() => null); } @@ -377,14 +377,23 @@ class FakeHtmlPlatformViewsController { } } +@immutable class FakeAndroidPlatformView { - FakeAndroidPlatformView(this.id, this.type, this.size, this.layoutDirection, [this.creationParams]); + const FakeAndroidPlatformView(this.id, this.type, this.size, this.layoutDirection, [this.creationParams]); final int id; final String type; final Uint8List creationParams; - Size size; - int layoutDirection; + final Size size; + final int layoutDirection; + + FakeAndroidPlatformView copyWith({Size size, int layoutDirection}) => FakeAndroidPlatformView( + id, + type, + size ?? this.size, + layoutDirection ?? this.layoutDirection, + creationParams, + ); @override bool operator ==(Object other) { @@ -393,12 +402,13 @@ class FakeAndroidPlatformView { return other is FakeAndroidPlatformView && other.id == id && other.type == type - && other.creationParams == creationParams - && other.size == size; + && listEquals(other.creationParams, creationParams) + && other.size == size + && other.layoutDirection == layoutDirection; } @override - int get hashCode => hashValues(id, type, size, layoutDirection); + int get hashCode => hashValues(id, type, hashList(creationParams), size, layoutDirection); @override String toString() { @@ -406,6 +416,7 @@ class FakeAndroidPlatformView { } } +@immutable class FakeAndroidMotionEvent { const FakeAndroidMotionEvent(this.action, this.pointerIds, this.pointers); @@ -431,8 +442,9 @@ class FakeAndroidMotionEvent { } } +@immutable class FakeUiKitView { - FakeUiKitView(this.id, this.type, [this.creationParams]); + const FakeUiKitView(this.id, this.type, [this.creationParams]); final int id; final String type; @@ -457,8 +469,9 @@ class FakeUiKitView { } } +@immutable class FakeHtmlPlatformView { - FakeHtmlPlatformView(this.id, this.type); + const FakeHtmlPlatformView(this.id, this.type); final int id; final String type; diff --git a/packages/flutter/test/services/platform_views_test.dart b/packages/flutter/test/services/platform_views_test.dart index 95172a8da0..57af2237ef 100644 --- a/packages/flutter/test/services/platform_views_test.dart +++ b/packages/flutter/test/services/platform_views_test.dart @@ -40,8 +40,8 @@ void main() { expect( viewsController.views, unorderedEquals([ - FakeAndroidPlatformView(0, 'webview', const Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), - FakeAndroidPlatformView(1, 'webview', const Size(200.0, 300.0), AndroidViewController.kAndroidLayoutDirectionRtl), + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), + const FakeAndroidPlatformView(1, 'webview', Size(200.0, 300.0), AndroidViewController.kAndroidLayoutDirectionRtl), ])); }); @@ -70,7 +70,7 @@ void main() { expect( viewsController.views, unorderedEquals([ - FakeAndroidPlatformView(0, 'webview', const Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), ])); }); @@ -96,8 +96,8 @@ void main() { expect( viewsController.views, unorderedEquals([ - FakeAndroidPlatformView(0, 'webview', const Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), - FakeAndroidPlatformView(1, 'webview', const Size(500.0, 500.0), AndroidViewController.kAndroidLayoutDirectionLtr), + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), + const FakeAndroidPlatformView(1, 'webview', Size(500.0, 500.0), AndroidViewController.kAndroidLayoutDirectionLtr), ])); }); @@ -137,7 +137,7 @@ void main() { expect( viewsController.views, unorderedEquals([ - FakeAndroidPlatformView(0, 'webview', const Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionLtr), ])); }); @@ -150,7 +150,7 @@ void main() { expect( viewsController.views, unorderedEquals([ - FakeAndroidPlatformView(0, 'webview', const Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionRtl), + const FakeAndroidPlatformView(0, 'webview', Size(100.0, 100.0), AndroidViewController.kAndroidLayoutDirectionRtl), ])); }); }); @@ -183,8 +183,8 @@ void main() { expect( viewsController.views, unorderedEquals([ - FakeUiKitView(0, 'webview'), - FakeUiKitView(1, 'webview'), + const FakeUiKitView(0, 'webview'), + const FakeUiKitView(1, 'webview'), ]), ); }); @@ -214,7 +214,7 @@ void main() { expect( viewsController.views, unorderedEquals([ - FakeUiKitView(0, 'webview'), + const FakeUiKitView(0, 'webview'), ])); }); diff --git a/packages/flutter/test/widgets/image_resolution_test.dart b/packages/flutter/test/widgets/image_resolution_test.dart index 9c07d1f8c7..1058f40796 100644 --- a/packages/flutter/test/widgets/image_resolution_test.dart +++ b/packages/flutter/test/widgets/image_resolution_test.dart @@ -103,7 +103,7 @@ class FakeImageStreamCompleter extends ImageStreamCompleter { } class TestAssetImage extends AssetImage { - TestAssetImage(String name) : super(name); + const TestAssetImage(String name) : super(name); @override ImageStreamCompleter load(AssetBundleImageKey key, DecoderCallback decode) { diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart index be718f335e..6432800cac 100644 --- a/packages/flutter/test/widgets/image_test.dart +++ b/packages/flutter/test/widgets/image_test.dart @@ -1622,6 +1622,7 @@ void main() { }); } +@immutable class ConfigurationAwareKey { const ConfigurationAwareKey(this.provider, this.configuration) : assert(provider != null), diff --git a/packages/flutter/test/widgets/key_test.dart b/packages/flutter/test/widgets/key_test.dart index 6989b8c0b1..47d502fa3a 100644 --- a/packages/flutter/test/widgets/key_test.dart +++ b/packages/flutter/test/widgets/key_test.dart @@ -9,6 +9,7 @@ class TestValueKey extends ValueKey { const TestValueKey(T value) : super(value); } +@immutable class NotEquals { const NotEquals(); @override diff --git a/packages/flutter/test/widgets/shortcuts_test.dart b/packages/flutter/test/widgets/shortcuts_test.dart index f5231bec0a..b2b74267d0 100644 --- a/packages/flutter/test/widgets/shortcuts_test.dart +++ b/packages/flutter/test/widgets/shortcuts_test.dart @@ -68,6 +68,7 @@ void main() { LogicalKeyboardKey.keyC, LogicalKeyboardKey.keyD, ); + // ignore: prefer_const_literals_to_create_immutables, https://github.com/dart-lang/linter/issues/2026 final LogicalKeySet setFromSet = LogicalKeySet.fromSet({ LogicalKeyboardKey.keyA, LogicalKeyboardKey.keyB, @@ -123,6 +124,7 @@ void main() { LogicalKeyboardKey.keyB, LogicalKeyboardKey.keyA, ); + // ignore: prefer_const_literals_to_create_immutables, https://github.com/dart-lang/linter/issues/2026 final LogicalKeySet set4 = LogicalKeySet.fromSet({ LogicalKeyboardKey.keyD, LogicalKeyboardKey.keyC, @@ -138,6 +140,7 @@ void main() { expect(map.containsKey(LogicalKeySet(LogicalKeyboardKey.keyA)), isTrue); expect( set2, + // ignore: prefer_const_literals_to_create_immutables, https://github.com/dart-lang/linter/issues/2026 equals(LogicalKeySet.fromSet({ LogicalKeyboardKey.keyA, LogicalKeyboardKey.keyB, diff --git a/packages/flutter_driver/lib/src/driver/driver.dart b/packages/flutter_driver/lib/src/driver/driver.dart index 4fd17f0c26..98bcbe4085 100644 --- a/packages/flutter_driver/lib/src/driver/driver.dart +++ b/packages/flutter_driver/lib/src/driver/driver.dart @@ -748,6 +748,7 @@ class CommonFinders { } /// An immutable 2D floating-point offset used by Flutter Driver. +@immutable class DriverOffset { /// Creates an offset. const DriverOffset(this.dx, this.dy); diff --git a/packages/flutter_test/test/matchers_test.dart b/packages/flutter_test/test/matchers_test.dart index 4fe0e99773..949359c9e7 100644 --- a/packages/flutter_test/test/matchers_test.dart +++ b/packages/flutter_test/test/matchers_test.dart @@ -240,27 +240,27 @@ void main() { test('isSameColorAs', () { expect( const Color(0x87654321), - isSameColorAs(_CustomColor(0x87654321)), + isSameColorAs(const _CustomColor(0x87654321)), ); expect( - _CustomColor(0x87654321), + const _CustomColor(0x87654321), isSameColorAs(const Color(0x87654321)), ); expect( const Color(0x12345678), - isNot(isSameColorAs(_CustomColor(0x87654321))), + isNot(isSameColorAs(const _CustomColor(0x87654321))), ); expect( - _CustomColor(0x87654321), + const _CustomColor(0x87654321), isNot(isSameColorAs(const Color(0x12345678))), ); expect( - _CustomColor(0xFF123456), - isSameColorAs(_CustomColor(0xFF123456)..isEqual = false), + const _CustomColor(0xFF123456), + isSameColorAs(const _CustomColor(0xFF123456, isEqual: false)), ); }); @@ -704,9 +704,10 @@ class _FakeSemanticsNode extends SemanticsNode { SemanticsData getSemanticsData() => data; } +@immutable class _CustomColor extends Color { - _CustomColor(int value) : super(value); - bool isEqual; + const _CustomColor(int value, {this.isEqual}) : super(value); + final bool isEqual; @override bool operator ==(Object other) => isEqual ?? super == other; diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart index 0a4a14656e..c2c33d1198 100644 --- a/packages/flutter_tools/lib/src/asset.dart +++ b/packages/flutter_tools/lib/src/asset.dart @@ -273,8 +273,9 @@ class _ManifestAssetBundle implements AssetBundle { List additionalDependencies = []; } +@immutable class _Asset { - _Asset({ this.baseDir, this.relativeUri, this.entryUri }); + const _Asset({ this.baseDir, this.relativeUri, this.entryUri }); final String baseDir; diff --git a/packages/flutter_tools/lib/src/base/fingerprint.dart b/packages/flutter_tools/lib/src/base/fingerprint.dart index f20e10763b..1f7f5aa91a 100644 --- a/packages/flutter_tools/lib/src/base/fingerprint.dart +++ b/packages/flutter_tools/lib/src/base/fingerprint.dart @@ -98,39 +98,49 @@ class Fingerprinter { /// properties. /// /// See [Fingerprinter]. +@immutable class Fingerprint { - Fingerprint.fromBuildInputs(Map properties, Iterable inputPaths) { + const Fingerprint._({ + Map checksums, + Map properties, + }) : _checksums = checksums, + _properties = properties; + + factory Fingerprint.fromBuildInputs(Map properties, Iterable inputPaths) { final Iterable files = inputPaths.map(globals.fs.file); final Iterable missingInputs = files.where((File file) => !file.existsSync()); if (missingInputs.isNotEmpty) { throw Exception('Missing input files:\n' + missingInputs.join('\n')); } - - _checksums = {}; - for (final File file in files) { - final List bytes = file.readAsBytesSync(); - _checksums[file.path] = md5.convert(bytes).toString(); - } - _properties = {...properties}; + return Fingerprint._( + // ignore: prefer_const_literals_to_create_immutables, https://github.com/dart-lang/linter/issues/2025 + checksums: { + for (final File file in files) + file.path: md5.convert(file.readAsBytesSync()).toString(), + }, + properties: {...properties}, + ); } /// Creates a Fingerprint from serialized JSON. /// /// Throws [Exception], if there is a version mismatch between the /// serializing framework and this framework. - Fingerprint.fromJson(String jsonData) { + factory Fingerprint.fromJson(String jsonData) { final Map content = castStringKeyedMap(json.decode(jsonData)); final String version = content['version'] as String; if (version != globals.flutterVersion.frameworkRevision) { throw Exception('Incompatible fingerprint version: $version'); } - _checksums = castStringKeyedMap(content['files'])?.cast() ?? {}; - _properties = castStringKeyedMap(content['properties'])?.cast() ?? {}; + return Fingerprint._( + checksums: castStringKeyedMap(content['files'])?.cast() ?? {}, + properties: castStringKeyedMap(content['properties'])?.cast() ?? {}, + ); } - Map _checksums; - Map _properties; + final Map _checksums; + final Map _properties; String toJson() => json.encode({ 'version': globals.flutterVersion.frameworkRevision, diff --git a/packages/flutter_tools/lib/src/base/version.dart b/packages/flutter_tools/lib/src/base/version.dart index 04a91fe3c7..edaf12a7b2 100644 --- a/packages/flutter_tools/lib/src/base/version.dart +++ b/packages/flutter_tools/lib/src/base/version.dart @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:meta/meta.dart'; + +@immutable class Version implements Comparable { /// Creates a new [Version] object. factory Version(int major, int minor, int patch, {String text}) { diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index 9ccb5a2868..85309ff71e 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -480,10 +480,14 @@ abstract class Device { Future takeScreenshot(File outputFile) => Future.error('unimplemented'); + @nonVirtual @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => id.hashCode; + @nonVirtual @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { if (identical(this, other)) { return true; diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart index 8549e29509..1a76ebbd2b 100644 --- a/packages/flutter_tools/lib/src/doctor.dart +++ b/packages/flutter_tools/lib/src/doctor.dart @@ -481,14 +481,15 @@ class GroupedValidator extends DoctorValidator { } } +@immutable class ValidationResult { /// [ValidationResult.type] should only equal [ValidationResult.installed] /// if no [messages] are hints or errors. - ValidationResult(this.type, this.messages, { this.statusInfo }); + const ValidationResult(this.type, this.messages, { this.statusInfo }); factory ValidationResult.crash(Object error, [StackTrace stackTrace]) { return ValidationResult(ValidationType.crash, [ - ValidationMessage.error( + const ValidationMessage.error( 'Due to an error, the doctor check did not complete. ' 'If the error message below is not helpful, ' 'please let us know about this issue at https://github.com/flutter/flutter/issues.'), @@ -555,10 +556,11 @@ class ValidationResult { } } +@immutable class ValidationMessage { - ValidationMessage(this.message) : type = ValidationMessageType.information; - ValidationMessage.error(this.message) : type = ValidationMessageType.error; - ValidationMessage.hint(this.message) : type = ValidationMessageType.hint; + const ValidationMessage(this.message) : type = ValidationMessageType.information; + const ValidationMessage.error(this.message) : type = ValidationMessageType.error; + const ValidationMessage.hint(this.message) : type = ValidationMessageType.hint; final ValidationMessageType type; bool get isError => type == ValidationMessageType.error; @@ -714,7 +716,7 @@ abstract class IntelliJValidator extends DoctorValidator { final List messages = []; if (pluginsPath == null) { - messages.add(ValidationMessage.error('Invalid IntelliJ version number.')); + messages.add(const ValidationMessage.error('Invalid IntelliJ version number.')); } else { messages.add(ValidationMessage(userMessages.intellijLocation(installPath))); diff --git a/packages/flutter_tools/lib/src/emulator.dart b/packages/flutter_tools/lib/src/emulator.dart index 7a9141014f..a4bea2127c 100644 --- a/packages/flutter_tools/lib/src/emulator.dart +++ b/packages/flutter_tools/lib/src/emulator.dart @@ -5,6 +5,8 @@ import 'dart:async'; import 'dart:math' as math; +import 'package:meta/meta.dart'; + import 'android/android_emulator.dart'; import 'android/android_sdk.dart'; import 'base/context.dart'; @@ -214,8 +216,9 @@ abstract class EmulatorDiscovery { Future> get emulators; } +@immutable abstract class Emulator { - Emulator(this.id, this.hasConfig); + const Emulator(this.id, this.hasConfig); final String id; final bool hasConfig; diff --git a/packages/flutter_tools/lib/src/ios/ios_emulators.dart b/packages/flutter_tools/lib/src/ios/ios_emulators.dart index e094266438..ca21a40933 100644 --- a/packages/flutter_tools/lib/src/ios/ios_emulators.dart +++ b/packages/flutter_tools/lib/src/ios/ios_emulators.dart @@ -22,7 +22,7 @@ class IOSEmulators extends EmulatorDiscovery { } class IOSEmulator extends Emulator { - IOSEmulator(String id) : super(id, true); + const IOSEmulator(String id) : super(id, true); @override String get name => 'iOS Simulator'; diff --git a/packages/flutter_tools/lib/src/linux/linux_doctor.dart b/packages/flutter_tools/lib/src/linux/linux_doctor.dart index edcd9f0a9a..026052c409 100644 --- a/packages/flutter_tools/lib/src/linux/linux_doctor.dart +++ b/packages/flutter_tools/lib/src/linux/linux_doctor.dart @@ -37,7 +37,7 @@ class LinuxDoctorValidator extends DoctorValidator { } if (clangResult == null || clangResult.exitCode != 0) { validationType = ValidationType.missing; - messages.add(ValidationMessage.error('clang++ is not installed')); + messages.add(const ValidationMessage.error('clang++ is not installed')); } else { final String firstLine = (clangResult.stdout as String).split('\n').first.trim(); final String versionString = RegExp(r'[0-9]+\.[0-9]+\.[0-9]+').firstMatch(firstLine).group(0); @@ -64,7 +64,7 @@ class LinuxDoctorValidator extends DoctorValidator { } if (makeResult == null || makeResult.exitCode != 0) { validationType = ValidationType.missing; - messages.add(ValidationMessage.error('make is not installed')); + messages.add(const ValidationMessage.error('make is not installed')); } else { final String firstLine = (makeResult.stdout as String).split('\n').first.trim(); messages.add(ValidationMessage(firstLine)); diff --git a/packages/flutter_tools/lib/src/proxy_validator.dart b/packages/flutter_tools/lib/src/proxy_validator.dart index 95896f2c11..7bc6cba6f6 100644 --- a/packages/flutter_tools/lib/src/proxy_validator.dart +++ b/packages/flutter_tools/lib/src/proxy_validator.dart @@ -28,10 +28,10 @@ class ProxyValidator extends DoctorValidator { final List messages = []; if (_httpProxy.isNotEmpty) { - messages.add(ValidationMessage('HTTP_PROXY is set')); + messages.add(const ValidationMessage('HTTP_PROXY is set')); if (_noProxy.isEmpty) { - messages.add(ValidationMessage.hint('NO_PROXY is not set')); + messages.add(const ValidationMessage.hint('NO_PROXY is not set')); } else { messages.add(ValidationMessage('NO_PROXY is $_noProxy')); for (final String host in const ['127.0.0.1', 'localhost']) { diff --git a/packages/flutter_tools/lib/src/vscode/vscode.dart b/packages/flutter_tools/lib/src/vscode/vscode.dart index 1856239df4..ce08e70c34 100644 --- a/packages/flutter_tools/lib/src/vscode/vscode.dart +++ b/packages/flutter_tools/lib/src/vscode/vscode.dart @@ -30,7 +30,7 @@ class VsCode { // If the extensions directory doesn't exist at all, the listSync() // below will fail, so just bail out early. - final ValidationMessage notInstalledMessage = ValidationMessage.error( + const ValidationMessage notInstalledMessage = ValidationMessage.error( 'Flutter extension not installed; install from\n$extensionMarketplaceUrl'); if (!globals.fs.isDirectorySync(extensionDirectory)) { _validationMessages.add(notInstalledMessage); diff --git a/packages/flutter_tools/lib/src/web/web_validator.dart b/packages/flutter_tools/lib/src/web/web_validator.dart index d18450d2d8..70cf224b66 100644 --- a/packages/flutter_tools/lib/src/web/web_validator.dart +++ b/packages/flutter_tools/lib/src/web/web_validator.dart @@ -36,7 +36,7 @@ class WebValidator extends DoctorValidator { ValidationMessage('$kChromeEnvironment = $chrome') else if (!canRunChrome) - ValidationMessage.hint('Cannot find Chrome. Try setting ' + const ValidationMessage.hint('Cannot find Chrome. Try setting ' '$kChromeEnvironment to a Chrome executable.') else ValidationMessage('Chrome at $chrome'), diff --git a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart index e40f144310..b2a58a567e 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart @@ -801,11 +801,11 @@ class PassingValidator extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage('A helpful message'), ValidationMessage('A second, somewhat longer helpful message'), ]; - return ValidationResult(ValidationType.installed, messages, statusInfo: 'with statusInfo'); + return const ValidationResult(ValidationType.installed, messages, statusInfo: 'with statusInfo'); } } @@ -814,12 +814,12 @@ class MissingValidator extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage.error('A useful error message'), ValidationMessage('A message that is not an error'), ValidationMessage.hint('A hint message'), ]; - return ValidationResult(ValidationType.missing, messages); + return const ValidationResult(ValidationType.missing, messages); } } @@ -828,12 +828,12 @@ class NotAvailableValidator extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage.error('A useful error message'), ValidationMessage('A message that is not an error'), ValidationMessage.hint('A hint message'), ]; - return ValidationResult(ValidationType.notAvailable, messages); + return const ValidationResult(ValidationType.notAvailable, messages); } } @@ -842,12 +842,12 @@ class PartialValidatorWithErrors extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage.error('An error message indicating partial installation'), ValidationMessage.hint('Maybe a hint will help the user'), ValidationMessage('An extra message with some verbose details'), ]; - return ValidationResult(ValidationType.partial, messages); + return const ValidationResult(ValidationType.partial, messages); } } @@ -856,11 +856,11 @@ class PartialValidatorWithHintsOnly extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage.hint('There is a hint here'), ValidationMessage('But there is no error'), ]; - return ValidationResult(ValidationType.partial, messages); + return const ValidationResult(ValidationType.partial, messages); } } @@ -1006,10 +1006,10 @@ class PassingGroupedValidator extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage('A helpful message'), ]; - return ValidationResult(ValidationType.installed, messages); + return const ValidationResult(ValidationType.installed, messages); } } @@ -1018,10 +1018,10 @@ class MissingGroupedValidator extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage.error('A useful error message'), ]; - return ValidationResult(ValidationType.missing, messages); + return const ValidationResult(ValidationType.missing, messages); } } @@ -1030,10 +1030,10 @@ class PartialGroupedValidator extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage.error('An error message for partial installation'), ]; - return ValidationResult(ValidationType.partial, messages); + return const ValidationResult(ValidationType.partial, messages); } } @@ -1042,10 +1042,10 @@ class PassingGroupedValidatorWithStatus extends DoctorValidator { @override Future validate() async { - final List messages = [ + const List messages = [ ValidationMessage('A different message'), ]; - return ValidationResult(ValidationType.installed, messages, statusInfo: 'A status message'); + return const ValidationResult(ValidationType.installed, messages, statusInfo: 'A status message'); } } diff --git a/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart b/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart index 9b776a2916..406fc39209 100644 --- a/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart @@ -31,7 +31,7 @@ void main() { const String emulatorID = '1234'; final AndroidEmulator emulator = AndroidEmulator( emulatorID, - {'name': 'test'}, + const {'name': 'test'}, ); expect(emulator.id, emulatorID); expect(emulator.hasConfig, true); diff --git a/packages/flutter_tools/test/general.shard/base/fingerprint_test.dart b/packages/flutter_tools/test/general.shard/base/fingerprint_test.dart index cef022ce2e..28518b242c 100644 --- a/packages/flutter_tools/test/general.shard/base/fingerprint_test.dart +++ b/packages/flutter_tools/test/general.shard/base/fingerprint_test.dart @@ -64,10 +64,10 @@ void main() { }, ); final Fingerprint fingerprint = fingerprinter.buildFingerprint(); - expect(fingerprint, Fingerprint.fromBuildInputs({ + expect(fingerprint, Fingerprint.fromBuildInputs(const { 'foo': 'bar', 'wibble': 'wobble', - }, ['a.dart'])); + }, const ['a.dart'])); }, overrides: contextOverrides); testUsingContext('creates fingerprint with file checksums', () { @@ -85,10 +85,10 @@ void main() { }, ); final Fingerprint fingerprint = fingerprinter.buildFingerprint(); - expect(fingerprint, Fingerprint.fromBuildInputs({ + expect(fingerprint, Fingerprint.fromBuildInputs(const { 'bar': 'baz', 'wobble': 'womble', - }, ['a.dart', 'b.dart'])); + }, const ['a.dart', 'b.dart'])); }, overrides: contextOverrides); testUsingContext('fingerprint does not match if not present', () { @@ -248,7 +248,7 @@ void main() { testUsingContext('throws if any input file does not exist', () { globals.fs.file('a.dart').createSync(); expect( - () => Fingerprint.fromBuildInputs({}, ['a.dart', 'b.dart']), + () => Fingerprint.fromBuildInputs(const {}, const ['a.dart', 'b.dart']), throwsException, ); }, overrides: { @@ -259,7 +259,7 @@ void main() { testUsingContext('populates checksums for valid files', () { globals.fs.file('a.dart').writeAsStringSync('This is a'); globals.fs.file('b.dart').writeAsStringSync('This is b'); - final Fingerprint fingerprint = Fingerprint.fromBuildInputs({}, ['a.dart', 'b.dart']); + final Fingerprint fingerprint = Fingerprint.fromBuildInputs(const {}, const ['a.dart', 'b.dart']); final Map jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson())); expect(jsonObject['files'], hasLength(2)); @@ -271,14 +271,14 @@ void main() { }); testUsingContext('includes framework version', () { - final Fingerprint fingerprint = Fingerprint.fromBuildInputs({}, []); + final Fingerprint fingerprint = Fingerprint.fromBuildInputs(const {}, const []); final Map jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson())); expect(jsonObject['version'], mockVersion.frameworkRevision); }, overrides: {FlutterVersion: () => mockVersion}); testUsingContext('includes provided properties', () { - final Fingerprint fingerprint = Fingerprint.fromBuildInputs({'a': 'A', 'b': 'B'}, []); + final Fingerprint fingerprint = Fingerprint.fromBuildInputs(const {'a': 'A', 'b': 'B'}, const []); final Map jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson())); expect(jsonObject['properties'], hasLength(2)); @@ -347,7 +347,7 @@ void main() { final String jsonString = json.encode({ 'version': kVersion, }); - expect(Fingerprint.fromJson(jsonString), Fingerprint.fromBuildInputs({}, [])); + expect(Fingerprint.fromJson(jsonString), Fingerprint.fromBuildInputs(const {}, const [])); }, overrides: { FlutterVersion: () => mockVersion, }); diff --git a/packages/flutter_tools/test/general.shard/emulator_test.dart b/packages/flutter_tools/test/general.shard/emulator_test.dart index 5a1a8e93ff..1a6eece8a4 100644 --- a/packages/flutter_tools/test/general.shard/emulator_test.dart +++ b/packages/flutter_tools/test/general.shard/emulator_test.dart @@ -45,11 +45,11 @@ void main() { }); testUsingContext('getEmulatorsById', () async { - final _MockEmulator emulator1 = + const _MockEmulator emulator1 = _MockEmulator('Nexus_5', 'Nexus 5', 'Google'); - final _MockEmulator emulator2 = + const _MockEmulator emulator2 = _MockEmulator('Nexus_5X_API_27_x86', 'Nexus 5X', 'Google'); - final _MockEmulator emulator3 = + const _MockEmulator emulator3 = _MockEmulator('iOS Simulator', 'iOS Simulator', 'Apple'); final List emulators = [ emulator1, @@ -137,7 +137,7 @@ void main() { }); }); testUsingContext('runs correct launch commands', () async { - final Emulator emulator = IOSEmulator('ios'); + const Emulator emulator = IOSEmulator('ios'); await emulator.launch(); expect(didAttemptToRunSimulator, equals(true)); }, overrides: { @@ -160,7 +160,7 @@ class TestEmulatorManager extends EmulatorManager { } class _MockEmulator extends Emulator { - _MockEmulator(String id, this.name, this.manufacturer) + const _MockEmulator(String id, this.name, this.manufacturer) : super(id, true); @override diff --git a/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart b/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart index 69a3a20bad..63af2e390c 100644 --- a/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart +++ b/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart @@ -27,7 +27,7 @@ void main() { final ValidationResult result = await linuxDoctorValidator.validate(); expect(result.type, ValidationType.installed); - expect(result.messages, [ + expect(result.messages, const [ ValidationMessage('clang++ 4.0.1'), ValidationMessage('GNU Make 4.1'), ]); @@ -50,7 +50,7 @@ void main() { final ValidationResult result = await linuxDoctorValidator.validate(); expect(result.type, ValidationType.partial); - expect(result.messages, [ + expect(result.messages, const [ ValidationMessage.error('clang++ 2.0.1 is below minimum version of 3.4.0'), ValidationMessage('GNU Make 4.1'), ]); @@ -73,7 +73,7 @@ void main() { final ValidationResult result = await linuxDoctorValidator.validate(); expect(result.type, ValidationType.missing); - expect(result.messages, [ + expect(result.messages, const [ ValidationMessage('clang++ 4.0.1'), ValidationMessage.error('make is not installed'), ]); @@ -96,7 +96,7 @@ void main() { final ValidationResult result = await linuxDoctorValidator.validate(); expect(result.type, ValidationType.missing); - expect(result.messages, [ + expect(result.messages, const [ ValidationMessage.error('clang++ is not installed'), ValidationMessage('GNU Make 4.1'), ]); diff --git a/packages/flutter_tools/test/general.shard/web/web_validator_test.dart b/packages/flutter_tools/test/general.shard/web/web_validator_test.dart index b2bb2bab45..2adcbd8e91 100644 --- a/packages/flutter_tools/test/general.shard/web/web_validator_test.dart +++ b/packages/flutter_tools/test/general.shard/web/web_validator_test.dart @@ -63,7 +63,7 @@ void main() { final ValidationResult result = await webValidator.validate(); - expect(result.messages, [ + expect(result.messages, const [ ValidationMessage.hint( 'Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.'), ]);