enable avoid_equals_and_hash_code_on_mutable_classes (#52507)

This commit is contained in:
Alexandre Ardhuin 2020-04-06 22:36:01 +02:00 committed by GitHub
parent 80bc3f4a3c
commit f5a9902577
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 308 additions and 199 deletions

View file

@ -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

View file

@ -623,8 +623,9 @@ Future<void> 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<Hash256> _grandfatheredBinaries = <Hash256>{
// 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<Hash256> _grandfatheredBinaries = <Hash256>{
// 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<Hash256> _grandfatheredBinaries = <Hash256>{
// 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<void> verifyNoBinaries(String workingDirectory, { Set<Hash256> grandfatheredBinaries }) async {

View file

@ -95,7 +95,7 @@ void main() {
test('analyze.dart - verifyNoBinaries - positive', () async {
final String result = await capture(() => verifyNoBinaries(
testRootPath,
grandfatheredBinaries: <Hash256>{Hash256(0x39A050CD69434936, 0, 0, 0)},
grandfatheredBinaries: <Hash256>{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>{
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);
});

View file

@ -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<String> arguments;

View file

@ -26,6 +26,7 @@ class SectionDetail {
final String imageAssetPackage;
}
@immutable
class Section {
const Section({
this.title,

View file

@ -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,

View file

@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import '../demo/all.dart';
import 'icons.dart';
@immutable
class GalleryDemoCategory {
const GalleryDemoCategory._({
@required this.name,

View file

@ -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,

View file

@ -4,6 +4,7 @@
import 'package:flutter/material.dart';
@immutable
class GalleryTextScaleValue {
const GalleryTextScaleValue(this.scale, this.label);
@ -37,6 +38,7 @@ const List<GalleryTextScaleValue> kAllGalleryTextScaleValues = <GalleryTextScale
GalleryTextScaleValue(2.0, 'Huge'),
];
@immutable
class GalleryVisualDensityValue {
const GalleryVisualDensityValue(this.visualDensity, this.label);

View file

@ -18,8 +18,9 @@ int sortFilesByPath (FileSystemEntity a, FileSystemEntity b) {
}
/// Simple data class to hold parsed locale. Does not promise validity of any data.
@immutable
class LocaleInfo implements Comparable<LocaleInfo> {
LocaleInfo({
const LocaleInfo({
this.languageCode,
this.scriptCode,
this.countryCode,

View file

@ -260,6 +260,7 @@ List<Point<double>> 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);

View file

@ -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);

View file

@ -11,6 +11,7 @@ import 'lsq_solver.dart';
export 'dart:ui' show Offset;
/// A velocity in two dimensions.
@immutable
class Velocity {
/// Creates a velocity.
///

View file

@ -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({

View file

@ -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

View file

@ -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({

View file

@ -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({

View file

@ -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.
///

View file

@ -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].

View file

@ -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].

View file

@ -2157,6 +2157,7 @@ class _RenderChipElement extends RenderObjectElement {
}
}
@immutable
class _ChipRenderTheme {
const _ChipRenderTheme({
@required this.avatar,

View file

@ -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],

View file

@ -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({

View file

@ -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

View file

@ -368,6 +368,7 @@ class _DropdownMenuRouteLayout<T> 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<T> {
const _DropdownRouteResult(this.result);

View file

@ -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].

View file

@ -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,

View file

@ -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({

View file

@ -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({

View file

@ -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);

View file

@ -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].

View file

@ -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({

View file

@ -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<K, V> {
/// * [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].
///

View file

@ -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].

View file

@ -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({

View file

@ -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<image_provider.NetworkImage> implements image_provider.NetworkImage {
/// Creates an object that fetches the image at the given URL.
///

View file

@ -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<image_provider.NetworkImage>
implements image_provider.NetworkImage {

View file

@ -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<T> extends Color {
/// Creates a color that has a small table of related colors called a "swatch".
///

View file

@ -530,6 +530,7 @@ class ImageCache {
///
/// To obtain an [ImageCacheStatus], use [ImageCache.statusForKey] or
/// [ImageProvider.obtainCacheStatus].
@immutable
class ImageCacheStatus {
const ImageCacheStatus._({
this.pending = false,

View file

@ -674,6 +674,7 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe
}
}
@immutable
class _SizeAwareCacheKey {
const _SizeAwareCacheKey(this.providerCacheKey, this.width, this.height);
@ -818,6 +819,7 @@ abstract class NetworkImage extends ImageProvider<NetworkImage> {
/// See also:
///
/// * [Image.file] for a shorthand of an [Image] widget backed by [FileImage].
@immutable
class FileImage extends ImageProvider<FileImage> {
/// Creates an object that decodes a [File] as an image.
///
@ -890,6 +892,7 @@ class FileImage extends ImageProvider<FileImage> {
/// See also:
///
/// * [Image.memory] for a shorthand of an [Image] widget backed by [MemoryImage].
@immutable
class MemoryImage extends ImageProvider<MemoryImage> {
/// Creates an object that decodes a [Uint8List] buffer as an image.
///
@ -1008,6 +1011,7 @@ class MemoryImage extends ImageProvider<MemoryImage> {
///
/// * [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.
///

View file

@ -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.
///

View file

@ -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.
///

View file

@ -623,6 +623,7 @@ class RawKeyboard {
void clearKeysPressed() => _keysPressed.clear();
}
@immutable
class _ModifierSidePair extends Object {
const _ModifierSidePair(this.modifier, this.side);

View file

@ -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({

View file

@ -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,

View file

@ -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;

View file

@ -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.
///

View file

@ -38,8 +38,9 @@ class PageStorageKey<T> extends ValueKey<T> {
const PageStorageKey(T value) : super(value);
}
@immutable
class _StorageEntryIdentifier {
_StorageEntryIdentifier(this.keys)
const _StorageEntryIdentifier(this.keys)
: assert(keys != null);
final List<PageStorageKey<dynamic>> keys;

View file

@ -82,6 +82,7 @@ class KeySet<T extends KeyboardKey> {
final HashSet<T> _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<T extends KeyboardKey> {
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) {

View file

@ -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,

View file

@ -553,7 +553,7 @@ Future<Size> _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<MemoryImage> obtainKey(ImageConfiguration configuration) {

View file

@ -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<dynamic>.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<dynamic>.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<int>(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;

View file

@ -40,8 +40,8 @@ void main() {
expect(
viewsController.views,
unorderedEquals(<FakeAndroidPlatformView>[
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>[
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>[
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>[
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>[
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>[
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>[
FakeUiKitView(0, 'webview'),
const FakeUiKitView(0, 'webview'),
]));
});

View file

@ -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) {

View file

@ -1622,6 +1622,7 @@ void main() {
});
}
@immutable
class ConfigurationAwareKey {
const ConfigurationAwareKey(this.provider, this.configuration)
: assert(provider != null),

View file

@ -9,6 +9,7 @@ class TestValueKey<T> extends ValueKey<T> {
const TestValueKey(T value) : super(value);
}
@immutable
class NotEquals {
const NotEquals();
@override

View file

@ -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>{
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>{
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>{
LogicalKeyboardKey.keyA,
LogicalKeyboardKey.keyB,

View file

@ -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);

View file

@ -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;

View file

@ -273,8 +273,9 @@ class _ManifestAssetBundle implements AssetBundle {
List<File> additionalDependencies = <File>[];
}
@immutable
class _Asset {
_Asset({ this.baseDir, this.relativeUri, this.entryUri });
const _Asset({ this.baseDir, this.relativeUri, this.entryUri });
final String baseDir;

View file

@ -98,39 +98,49 @@ class Fingerprinter {
/// properties.
///
/// See [Fingerprinter].
@immutable
class Fingerprint {
Fingerprint.fromBuildInputs(Map<String, String> properties, Iterable<String> inputPaths) {
const Fingerprint._({
Map<String, String> checksums,
Map<String, String> properties,
}) : _checksums = checksums,
_properties = properties;
factory Fingerprint.fromBuildInputs(Map<String, String> properties, Iterable<String> inputPaths) {
final Iterable<File> files = inputPaths.map<File>(globals.fs.file);
final Iterable<File> missingInputs = files.where((File file) => !file.existsSync());
if (missingInputs.isNotEmpty) {
throw Exception('Missing input files:\n' + missingInputs.join('\n'));
}
_checksums = <String, String>{};
for (final File file in files) {
final List<int> bytes = file.readAsBytesSync();
_checksums[file.path] = md5.convert(bytes).toString();
}
_properties = <String, String>{...properties};
return Fingerprint._(
// ignore: prefer_const_literals_to_create_immutables, https://github.com/dart-lang/linter/issues/2025
checksums: <String, String>{
for (final File file in files)
file.path: md5.convert(file.readAsBytesSync()).toString(),
},
properties: <String, String>{...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<String, dynamic> 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<String,String>() ?? <String, String>{};
_properties = castStringKeyedMap(content['properties'])?.cast<String,String>() ?? <String, String>{};
return Fingerprint._(
checksums: castStringKeyedMap(content['files'])?.cast<String,String>() ?? <String, String>{},
properties: castStringKeyedMap(content['properties'])?.cast<String,String>() ?? <String, String>{},
);
}
Map<String, String> _checksums;
Map<String, String> _properties;
final Map<String, String> _checksums;
final Map<String, String> _properties;
String toJson() => json.encode(<String, dynamic>{
'version': globals.flutterVersion.frameworkRevision,

View file

@ -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<Version> {
/// Creates a new [Version] object.
factory Version(int major, int minor, int patch, {String text}) {

View file

@ -480,10 +480,14 @@ abstract class Device {
Future<void> takeScreenshot(File outputFile) => Future<void>.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;

View file

@ -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>[
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<ValidationMessage> messages = <ValidationMessage>[];
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)));

View file

@ -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<List<Emulator>> get emulators;
}
@immutable
abstract class Emulator {
Emulator(this.id, this.hasConfig);
const Emulator(this.id, this.hasConfig);
final String id;
final bool hasConfig;

View file

@ -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';

View file

@ -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));

View file

@ -28,10 +28,10 @@ class ProxyValidator extends DoctorValidator {
final List<ValidationMessage> messages = <ValidationMessage>[];
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 <String>['127.0.0.1', 'localhost']) {

View file

@ -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);

View file

@ -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'),

View file

@ -801,11 +801,11 @@ class PassingValidator extends DoctorValidator {
@override
Future<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
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<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[
const List<ValidationMessage> messages = <ValidationMessage>[
ValidationMessage('A different message'),
];
return ValidationResult(ValidationType.installed, messages, statusInfo: 'A status message');
return const ValidationResult(ValidationType.installed, messages, statusInfo: 'A status message');
}
}

View file

@ -31,7 +31,7 @@ void main() {
const String emulatorID = '1234';
final AndroidEmulator emulator = AndroidEmulator(
emulatorID,
<String, String>{'name': 'test'},
const <String, String>{'name': 'test'},
);
expect(emulator.id, emulatorID);
expect(emulator.hasConfig, true);

View file

@ -64,10 +64,10 @@ void main() {
},
);
final Fingerprint fingerprint = fingerprinter.buildFingerprint();
expect(fingerprint, Fingerprint.fromBuildInputs(<String, String>{
expect(fingerprint, Fingerprint.fromBuildInputs(const <String, String>{
'foo': 'bar',
'wibble': 'wobble',
}, <String>['a.dart']));
}, const <String>['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(<String, String>{
expect(fingerprint, Fingerprint.fromBuildInputs(const <String, String>{
'bar': 'baz',
'wobble': 'womble',
}, <String>['a.dart', 'b.dart']));
}, const <String>['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(<String, String>{}, <String>['a.dart', 'b.dart']),
() => Fingerprint.fromBuildInputs(const <String, String>{}, const <String>['a.dart', 'b.dart']),
throwsException,
);
}, overrides: <Type, Generator>{
@ -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(<String, String>{}, <String>['a.dart', 'b.dart']);
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(const <String, String>{}, const <String>['a.dart', 'b.dart']);
final Map<String, dynamic> 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(<String, String>{}, <String>[]);
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(const <String, String>{}, const <String>[]);
final Map<String, dynamic> jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson()));
expect(jsonObject['version'], mockVersion.frameworkRevision);
}, overrides: <Type, Generator>{FlutterVersion: () => mockVersion});
testUsingContext('includes provided properties', () {
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{'a': 'A', 'b': 'B'}, <String>[]);
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(const <String, String>{'a': 'A', 'b': 'B'}, const <String>[]);
final Map<String, dynamic> jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson()));
expect(jsonObject['properties'], hasLength(2));
@ -347,7 +347,7 @@ void main() {
final String jsonString = json.encode(<String, dynamic>{
'version': kVersion,
});
expect(Fingerprint.fromJson(jsonString), Fingerprint.fromBuildInputs(<String, String>{}, <String>[]));
expect(Fingerprint.fromJson(jsonString), Fingerprint.fromBuildInputs(const <String, String>{}, const <String>[]));
}, overrides: <Type, Generator>{
FlutterVersion: () => mockVersion,
});

View file

@ -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<Emulator> emulators = <Emulator>[
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: <Type, Generator>{
@ -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

View file

@ -27,7 +27,7 @@ void main() {
final ValidationResult result = await linuxDoctorValidator.validate();
expect(result.type, ValidationType.installed);
expect(result.messages, <ValidationMessage>[
expect(result.messages, const <ValidationMessage>[
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, <ValidationMessage>[
expect(result.messages, const <ValidationMessage>[
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, <ValidationMessage>[
expect(result.messages, const <ValidationMessage>[
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, <ValidationMessage>[
expect(result.messages, const <ValidationMessage>[
ValidationMessage.error('clang++ is not installed'),
ValidationMessage('GNU Make 4.1'),
]);

View file

@ -63,7 +63,7 @@ void main() {
final ValidationResult result = await webValidator.validate();
expect(result.messages, <ValidationMessage>[
expect(result.messages, const <ValidationMessage>[
ValidationMessage.hint(
'Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.'),
]);