From 8c1a2c2c5172cf778549cd9d4c7777dc08a3beb5 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 12 Jul 2024 21:33:48 -0700 Subject: [PATCH] Drop self-references to hash functions from doc comments (flutter/engine#53844) Towards https://github.com/flutter/flutter/issues/151679 --- engine/src/flutter/lib/ui/hash_codes.dart | 15 ------------- .../flutter/lib/web_ui/lib/hash_codes.dart | 22 +++++++++++-------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/engine/src/flutter/lib/ui/hash_codes.dart b/engine/src/flutter/lib/ui/hash_codes.dart index 6023dc20f7..0d9ecec95f 100644 --- a/engine/src/flutter/lib/ui/hash_codes.dart +++ b/engine/src/flutter/lib/ui/hash_codes.dart @@ -32,21 +32,6 @@ class _Jenkins { } } -/// Combine up to twenty objects' hash codes into one value. -/// -/// If you only need to handle one object's hash code, then just refer to its -/// [Object.hashCode] getter directly. -/// -/// If you need to combine an arbitrary number of objects from a [List] or other -/// [Iterable], use [hashList]. The output of [hashList] can be used as one of -/// the arguments to this function. -/// -/// For example: -/// -/// ```dart -/// int get hashCode => hashValues(foo, bar, hashList(quux), baz); -/// ``` -/// /// ## Deprecation /// /// This function has been replaced by [Object.hash], so that it can be used diff --git a/engine/src/flutter/lib/web_ui/lib/hash_codes.dart b/engine/src/flutter/lib/web_ui/lib/hash_codes.dart index 3b6432d5a3..18e18ad27b 100644 --- a/engine/src/flutter/lib/web_ui/lib/hash_codes.dart +++ b/engine/src/flutter/lib/web_ui/lib/hash_codes.dart @@ -26,19 +26,23 @@ class _Jenkins { } } -/// Combine up to twenty objects' hash codes into one value. +/// ## Deprecation /// -/// If you only need to handle one object's hash code, then just refer to its -/// [Object.hashCode] getter directly. +/// This function has been replaced by [Object.hash], so that it can be used +/// outside of Flutter as well. The new function is a drop-in replacement. /// -/// If you need to combine an arbitrary number of objects from a [List] or other -/// [Iterable], use [hashList]. The output of [hashList] can be used as one of -/// the arguments to this function. -/// -/// For example: +/// The [hashList] function has also been replaced, [Object.hashAll] is the new +/// function. The example above therefore is better written as: /// /// ```dart -/// int hashCode => hashValues(foo, bar, hashList(quux), baz); +/// int get hashCode => Object.hash(foo, bar, Object.hashAll(quux), baz); +/// ``` +/// +/// If a parameter is nullable, then it needs special handling, +/// because [Object.hashAll]'s argument is not nullable: +/// +/// ```dart +/// int get hashCode => Object.hash(foo, bar, thud == null ? null : Object.hashAll(thud!), baz); /// ``` @Deprecated( 'Use Object.hash() instead. '