complete migration of flutter repo to Object.hash* (#99505)
diff --git a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_board.dart b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_board.dart
index 309f950..c1e02be 100644
--- a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_board.dart
+++ b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_board.dart
@@ -275,7 +275,7 @@
}
@override
- int get hashCode => hashValues(q, r);
+ int get hashCode => Object.hash(q, r);
BoardPoint copyWithColor(Color nextColor) => BoardPoint(q, r, color: nextColor);
diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart b/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart
index aca4172..5e6d449 100644
--- a/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart
+++ b/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart
@@ -37,7 +37,7 @@
}
@override
- int get hashCode => hashValues(tabName, description, documentationUrl);
+ int get hashCode => Object.hash(tabName, description, documentationUrl);
}
class TabbedComponentDemoScaffold extends StatelessWidget {
diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart b/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart
index bf2dbad..13af769 100644
--- a/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart
+++ b/dev/integration_tests/flutter_gallery/lib/gallery/demos.dart
@@ -29,7 +29,7 @@
}
@override
- int get hashCode => hashValues(name, icon);
+ int get hashCode => Object.hash(name, icon);
@override
String toString() {
diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/options.dart b/dev/integration_tests/flutter_gallery/lib/gallery/options.dart
index 389caeb..0c96fdc 100644
--- a/dev/integration_tests/flutter_gallery/lib/gallery/options.dart
+++ b/dev/integration_tests/flutter_gallery/lib/gallery/options.dart
@@ -71,7 +71,7 @@
}
@override
- int get hashCode => hashValues(
+ int get hashCode => Object.hash(
themeMode,
textScaleFactor,
visualDensity,
diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart b/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart
index 12549cb..09c4909 100644
--- a/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart
+++ b/dev/integration_tests/flutter_gallery/lib/gallery/scales.dart
@@ -21,7 +21,7 @@
}
@override
- int get hashCode => hashValues(scale, label);
+ int get hashCode => Object.hash(scale, label);
@override
String toString() {
@@ -55,7 +55,7 @@
}
@override
- int get hashCode => hashValues(visualDensity, label);
+ int get hashCode => Object.hash(visualDensity, label);
@override
String toString() {
diff --git a/dev/integration_tests/web/lib/stack_trace.dart b/dev/integration_tests/web/lib/stack_trace.dart
index 21d4eb4..6bc160c 100644
--- a/dev/integration_tests/web/lib/stack_trace.dart
+++ b/dev/integration_tests/web/lib/stack_trace.dart
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'dart:html' as html;
-import 'dart:ui';
import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
@@ -33,7 +32,7 @@
packageScheme: 'package',
package: 'packages',
packagePath: 'web_integration/stack_trace.dart',
- line: 120,
+ line: 119,
column: 3,
className: '<unknown>',
method: 'baz',
@@ -44,7 +43,7 @@
packageScheme: 'package',
package: 'packages',
packagePath: 'web_integration/stack_trace.dart',
- line: 115,
+ line: 114,
column: 3,
className: '<unknown>',
method: 'bar',
@@ -55,7 +54,7 @@
packageScheme: 'package',
package: 'packages',
packagePath: 'web_integration/stack_trace.dart',
- line: 110,
+ line: 109,
column: 3,
className: '<unknown>',
method: 'foo',
@@ -154,7 +153,7 @@
// TODO(dnfield): This ignore shouldn't be necessary, see https://github.com/dart-lang/sdk/issues/46477
@override
int hash(StackFrame e) { // ignore: avoid_renaming_method_parameters
- return hashValues(e.number, e.packageScheme, e.package, e.packagePath, e.line, e.column, e.className, e.method);
+ return Object.hash(e.number, e.packageScheme, e.package, e.packagePath, e.line, e.column, e.className, e.method);
}
@override
diff --git a/examples/api/lib/material/autocomplete/autocomplete.1.dart b/examples/api/lib/material/autocomplete/autocomplete.1.dart
index d4da62e..d6031f4 100644
--- a/examples/api/lib/material/autocomplete/autocomplete.1.dart
+++ b/examples/api/lib/material/autocomplete/autocomplete.1.dart
@@ -50,7 +50,7 @@
}
@override
- int get hashCode => hashValues(email, name);
+ int get hashCode => Object.hash(email, name);
}
class AutocompleteBasicUserExample extends StatelessWidget {
diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart
index ced20be..bdc4803 100644
--- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart
+++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.1.dart
@@ -52,7 +52,7 @@
}
@override
- int get hashCode => hashValues(email, name);
+ int get hashCode => Object.hash(email, name);
}
class AutocompleteCustomTypeExample extends StatelessWidget {
diff --git a/packages/flutter/lib/src/foundation/README.md b/packages/flutter/lib/src/foundation/README.md
index 8f62a9b..5e4de07 100644
--- a/packages/flutter/lib/src/foundation/README.md
+++ b/packages/flutter/lib/src/foundation/README.md
@@ -3,9 +3,9 @@
can't depend on any `package:`, and they can't depend on anything
outside this directory.
-Currently they do depend on dart:ui, but only for `VoidCallback` and
-`hashValues` (and maybe one day `hashList` and `lerpDouble`), which
-are all intended to be moved out of `dart:ui` and into `dart:core`.
+Currently they do depend on dart:ui, but only for `VoidCallback` (and
+maybe one day `lerpDouble`), which are all intended to be moved out
+of `dart:ui` and into `dart:core`.
There is currently also an unfortunate dependency on the platform
dispatcher logic (SingletonFlutterWindow, Brightness,
diff --git a/packages/flutter/lib/src/material/expansion_tile_theme.dart b/packages/flutter/lib/src/material/expansion_tile_theme.dart
index d2c22a6..2f493f2 100644
--- a/packages/flutter/lib/src/material/expansion_tile_theme.dart
+++ b/packages/flutter/lib/src/material/expansion_tile_theme.dart
@@ -123,7 +123,7 @@
@override
int get hashCode {
- return hashValues(
+ return Object.hash(
backgroundColor,
collapsedBackgroundColor,
tilePadding,
diff --git a/packages/flutter/lib/src/painting/basic_types.dart b/packages/flutter/lib/src/painting/basic_types.dart
index 373c37d..460aeef 100644
--- a/packages/flutter/lib/src/painting/basic_types.dart
+++ b/packages/flutter/lib/src/painting/basic_types.dart
@@ -41,7 +41,8 @@
TextPosition,
TileMode,
VertexMode,
- // TODO(werainkhatri): remove these after all the dependencies are migrated
+ // TODO(werainkhatri): remove these after their deprecation period in engine
+ // https://github.com/flutter/flutter/pull/99505
hashValues,
hashList;
diff --git a/packages/flutter/lib/src/widgets/shortcuts.dart b/packages/flutter/lib/src/widgets/shortcuts.dart
index da14b09..9fdbe43 100644
--- a/packages/flutter/lib/src/widgets/shortcuts.dart
+++ b/packages/flutter/lib/src/widgets/shortcuts.dart
@@ -121,7 +121,7 @@
: Object.hash(h2, h1);
}
- // Sort key hash codes and feed to hashList to ensure the aggregate
+ // Sort key hash codes and feed to Object.hashAll to ensure the aggregate
// hash code does not depend on the key order.
final List<int> sortedHashes = length == 3
? _tempHashStore3
diff --git a/packages/flutter/test/material/animated_icons_test.dart b/packages/flutter/test/material/animated_icons_test.dart
index 57ae8a5..66d9c19 100644
--- a/packages/flutter/test/material/animated_icons_test.dart
+++ b/packages/flutter/test/material/animated_icons_test.dart
@@ -90,7 +90,7 @@
}
@override
- int get hashCode => hashValues(sx, sy);
+ int get hashCode => Object.hash(sx, sy);
}
void main() {
diff --git a/packages/flutter_goldens/test/flutter_goldens_test.dart b/packages/flutter_goldens/test/flutter_goldens_test.dart
index feb3ef7..4363c04 100644
--- a/packages/flutter_goldens/test/flutter_goldens_test.dart
+++ b/packages/flutter_goldens/test/flutter_goldens_test.dart
@@ -8,7 +8,6 @@
import 'dart:convert';
import 'dart:io' hide Directory;
import 'dart:typed_data';
-import 'dart:ui' show hashValues, hashList;
import 'package:file/file.dart';
import 'package:file/memory.dart';
@@ -873,7 +872,7 @@
final String? workingDirectory;
@override
- int get hashCode => hashValues(hashList(command), workingDirectory);
+ int get hashCode => Object.hash(Object.hashAll(command), workingDirectory);
bool _commandEquals(List<String> other) {
if (other == command) {
diff --git a/packages/flutter_test/lib/src/image.dart b/packages/flutter_test/lib/src/image.dart
index 55ca492..c5b8065 100644
--- a/packages/flutter_test/lib/src/image.dart
+++ b/packages/flutter_test/lib/src/image.dart
@@ -6,8 +6,6 @@
import 'dart:typed_data';
import 'dart:ui' as ui;
-import 'package:flutter/painting.dart';
-
import 'test_async_utils.dart';
final Map<int, ui.Image> _cache = <int, ui.Image>{};
@@ -35,7 +33,7 @@
assert(height != null && height > 0);
assert(cache != null);
- final int cacheKey = hashValues(width, height);
+ final int cacheKey = Object.hash(width, height);
if (cache && _cache.containsKey(cacheKey)) {
return _cache[cacheKey]!.clone();
}
diff --git a/packages/flutter_test/lib/src/window.dart b/packages/flutter_test/lib/src/window.dart
index bf43a49..aeed9ac 100644
--- a/packages/flutter_test/lib/src/window.dart
+++ b/packages/flutter_test/lib/src/window.dart
@@ -581,7 +581,7 @@
}
@override
- int get hashCode => ui.hashValues(accessibleNavigation, invertColors, disableAnimations, boldText, reduceMotion, highContrast);
+ int get hashCode => Object.hash(accessibleNavigation, invertColors, disableAnimations, boldText, reduceMotion, highContrast);
/// This gives us some grace time when the dart:ui side adds something to
/// [AccessibilityFeatures], and makes things easier when we do rolls to
diff --git a/packages/flutter_test/test/matchers_test.dart b/packages/flutter_test/test/matchers_test.dart
index 3877dd0..5483185 100644
--- a/packages/flutter_test/test/matchers_test.dart
+++ b/packages/flutter_test/test/matchers_test.dart
@@ -738,5 +738,5 @@
bool operator ==(Object other) => isEqual ?? super == other;
@override
- int get hashCode => hashValues(super.hashCode, isEqual);
+ int get hashCode => Object.hash(super.hashCode, isEqual);
}
diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart
index dc7b18b..ce230c0 100644
--- a/packages/flutter_tools/lib/src/commands/update_packages.dart
+++ b/packages/flutter_tools/lib/src/commands/update_packages.dart
@@ -1066,7 +1066,7 @@
class PubspecChecksum extends PubspecLine {
PubspecChecksum(this.value, String line) : super(line);
- /// The checksum value, computed using [hashValues] over the direct, dev,
+ /// The checksum value, computed using [Object.hash] over the direct, dev,
/// and special dependencies sorted lexically.
///
/// If the line cannot be parsed, [value] will be null.