mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 07:08:10 +08:00
[various] migrate from ui.hash* to Object.hash* (#1581)
* migrate from ui.hash* to Object.hash*
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
## 4.1.2
|
||||
|
||||
* Migrates from `ui.hash*` to `Object.hash*`.
|
||||
|
||||
## 4.1.1
|
||||
|
||||
* Updates package description.
|
||||
|
@ -222,7 +222,7 @@ class NetworkImageWithRetry extends ImageProvider<NetworkImageWithRetry> {
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => hashValues(url, scale);
|
||||
int get hashCode => Object.hash(url, scale);
|
||||
|
||||
@override
|
||||
String toString() => '$runtimeType("$url", scale: $scale)';
|
||||
|
@ -3,7 +3,7 @@ description: >
|
||||
Image utilities for Flutter: improved network providers, effects, etc.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/flutter_image
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_image%22
|
||||
version: 4.1.1
|
||||
version: 4.1.2
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 0.6.10+2
|
||||
|
||||
* Migrates from `ui.hash*` to `Object.hash*`.
|
||||
|
||||
## 0.6.10+1
|
||||
|
||||
* Updates Linux example to remove unneeded library dependencies that
|
||||
|
@ -716,7 +716,7 @@ class MarkdownStyleSheet {
|
||||
@override
|
||||
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
||||
int get hashCode {
|
||||
return hashList(<Object?>[
|
||||
return Object.hashAll(<Object?>[
|
||||
a,
|
||||
p,
|
||||
pPadding,
|
||||
|
@ -4,7 +4,7 @@ description: A Markdown renderer for Flutter. Create rich text output,
|
||||
formatted with simple Markdown tags.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
|
||||
version: 0.6.10+1
|
||||
version: 0.6.10+2
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 0.3.2+1
|
||||
|
||||
* Migrates from `ui.hash*` to `Object.hash*`.
|
||||
|
||||
## 0.3.2
|
||||
|
||||
* Updates package description.
|
||||
|
@ -10,23 +10,6 @@ import 'package:meta/meta.dart';
|
||||
import 'package:multicast_dns/src/constants.dart';
|
||||
import 'package:multicast_dns/src/packet.dart';
|
||||
|
||||
// TODO(dnfield): Probably should go with a real hashing function here
|
||||
// when https://github.com/dart-lang/sdk/issues/11617 is figured out.
|
||||
const int _seedHashPrime = 2166136261;
|
||||
const int _multipleHashPrime = 16777619;
|
||||
|
||||
int _combineHash(int current, int hash) =>
|
||||
(current & _multipleHashPrime) ^ hash;
|
||||
|
||||
int _hashValues(List<int> values) {
|
||||
assert(values.isNotEmpty);
|
||||
|
||||
return values.fold(
|
||||
_seedHashPrime,
|
||||
(int current, int next) => _combineHash(current, next),
|
||||
);
|
||||
}
|
||||
|
||||
/// Enumeration of support resource record types.
|
||||
abstract class ResourceRecordType {
|
||||
// This class is intended to be used as a namespace, and should not be
|
||||
@ -171,8 +154,8 @@ class ResourceRecordQuery {
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => _hashValues(
|
||||
<int>[resourceRecordType, fullyQualifiedName.hashCode, questionType]);
|
||||
int get hashCode =>
|
||||
Object.hash(resourceRecordType, fullyQualifiedName, questionType);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
@ -209,30 +192,16 @@ abstract class ResourceRecord {
|
||||
'$runtimeType{$name, validUntil: ${DateTime.fromMillisecondsSinceEpoch(validUntil)}, $_additionalInfo}';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is ResourceRecord && _equals(other);
|
||||
}
|
||||
int get hashCode => Object.hash(name, validUntil, resourceRecordType);
|
||||
|
||||
bool _equals(ResourceRecord other) {
|
||||
return other.name == name &&
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is ResourceRecord &&
|
||||
other.name == name &&
|
||||
other.validUntil == validUntil &&
|
||||
other.resourceRecordType == resourceRecordType;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return _hashValues(<int>[
|
||||
name.hashCode,
|
||||
validUntil.hashCode,
|
||||
resourceRecordType.hashCode,
|
||||
_hashCode,
|
||||
]);
|
||||
}
|
||||
|
||||
// Subclasses of this class should use _hashValues to create a hash code
|
||||
// that will then get hashed in with the common values on this class.
|
||||
int get _hashCode;
|
||||
|
||||
/// Low level method for encoding this record into an mDNS packet.
|
||||
///
|
||||
/// Subclasses should provide the packet format of their encapsulated data
|
||||
@ -257,14 +226,14 @@ class PtrResourceRecord extends ResourceRecord {
|
||||
String get _additionalInfo => 'domainName: $domainName';
|
||||
|
||||
@override
|
||||
bool _equals(ResourceRecord other) {
|
||||
return other is PtrResourceRecord &&
|
||||
other.domainName == domainName &&
|
||||
super._equals(other);
|
||||
}
|
||||
int get hashCode => Object.hash(domainName.hashCode, super.hashCode);
|
||||
|
||||
@override
|
||||
int get _hashCode => _combineHash(_seedHashPrime, domainName.hashCode);
|
||||
bool operator ==(Object other) {
|
||||
return super == other &&
|
||||
other is PtrResourceRecord &&
|
||||
other.domainName == domainName;
|
||||
}
|
||||
|
||||
@override
|
||||
Uint8List encodeResponseRecord() {
|
||||
@ -293,12 +262,14 @@ class IPAddressResourceRecord extends ResourceRecord {
|
||||
String get _additionalInfo => 'address: $address';
|
||||
|
||||
@override
|
||||
bool _equals(ResourceRecord other) {
|
||||
return other is IPAddressResourceRecord && other.address == address;
|
||||
}
|
||||
int get hashCode => Object.hash(address.hashCode, super.hashCode);
|
||||
|
||||
@override
|
||||
int get _hashCode => _combineHash(_seedHashPrime, address.hashCode);
|
||||
bool operator ==(Object other) {
|
||||
return super == other &&
|
||||
other is IPAddressResourceRecord &&
|
||||
other.address == address;
|
||||
}
|
||||
|
||||
@override
|
||||
Uint8List encodeResponseRecord() {
|
||||
@ -335,22 +306,19 @@ class SrvResourceRecord extends ResourceRecord {
|
||||
'target: $target, port: $port, priority: $priority, weight: $weight';
|
||||
|
||||
@override
|
||||
bool _equals(ResourceRecord other) {
|
||||
return other is SrvResourceRecord &&
|
||||
int get hashCode =>
|
||||
Object.hash(target, port, priority, weight, super.hashCode);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return super == other &&
|
||||
other is SrvResourceRecord &&
|
||||
other.target == target &&
|
||||
other.port == port &&
|
||||
other.priority == priority &&
|
||||
other.weight == weight;
|
||||
}
|
||||
|
||||
@override
|
||||
int get _hashCode => _hashValues(<int>[
|
||||
target.hashCode,
|
||||
port.hashCode,
|
||||
priority.hashCode,
|
||||
weight.hashCode,
|
||||
]);
|
||||
|
||||
@override
|
||||
Uint8List encodeResponseRecord() {
|
||||
final List<int> data = utf8.encode(target);
|
||||
@ -380,12 +348,11 @@ class TxtResourceRecord extends ResourceRecord {
|
||||
String get _additionalInfo => 'text: $text';
|
||||
|
||||
@override
|
||||
bool _equals(ResourceRecord other) {
|
||||
return other is TxtResourceRecord && other.text == text;
|
||||
}
|
||||
int get hashCode => Object.hash(text.hashCode, super.hashCode);
|
||||
|
||||
@override
|
||||
int get _hashCode => _combineHash(_seedHashPrime, text.hashCode);
|
||||
bool operator ==(Object other) =>
|
||||
super == other && other is TxtResourceRecord && other.text == text;
|
||||
|
||||
@override
|
||||
Uint8List encodeResponseRecord() {
|
||||
|
@ -2,10 +2,10 @@ name: multicast_dns
|
||||
description: Dart package for performing mDNS queries (e.g. Bonjour, Avahi).
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/multicast_dns
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+multicast_dns%22
|
||||
version: 0.3.2
|
||||
version: 0.3.2+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
sdk: ">=2.14.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
meta: ^1.3.0
|
||||
|
@ -158,7 +158,7 @@ void testValidPackages() {
|
||||
domainName: '______________________._______________.____._____',
|
||||
),
|
||||
TxtResourceRecord(
|
||||
'_______________.____._____',
|
||||
'______________________.____________.____._____',
|
||||
result[1].validUntil,
|
||||
text: 'model=MacBookPro14,3\nosxvers=18\necolor=225,225,223\n',
|
||||
),
|
||||
@ -176,7 +176,7 @@ void testValidPackages() {
|
||||
domainName: '______________________._______________.____._____',
|
||||
),
|
||||
TxtResourceRecord(
|
||||
'_______________.____._____',
|
||||
'______________________.____________.____._____',
|
||||
result[1].validUntil,
|
||||
text: (')' * 129) + '\n',
|
||||
),
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 0.3.3+1
|
||||
|
||||
* Migrates from `ui.hash*` to `Object.hash*`.
|
||||
|
||||
## 0.3.3
|
||||
|
||||
* Avoids dynamic calls in equality checks.
|
||||
|
@ -634,7 +634,7 @@ class PaletteTarget with Diagnosticable {
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return hashValues(
|
||||
return Object.hash(
|
||||
minimumSaturation,
|
||||
targetSaturation,
|
||||
maximumSaturation,
|
||||
@ -852,9 +852,7 @@ class PaletteColor with Diagnosticable {
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return hashValues(color, population);
|
||||
}
|
||||
int get hashCode => Object.hash(color, population);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
|
@ -2,11 +2,11 @@ name: palette_generator
|
||||
description: Flutter package for generating palette colors from a source image.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/palette_generator
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+palette_generator%22
|
||||
version: 0.3.3
|
||||
version: 0.3.3+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
flutter: ">=1.15.21"
|
||||
sdk: ">=2.14.0 <3.0.0"
|
||||
flutter: ">=3.0.0"
|
||||
|
||||
dependencies:
|
||||
collection: ^1.15.0
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 1.0.4
|
||||
|
||||
* Migrates from `ui.hash*` to `Object.hash*`.
|
||||
|
||||
## 1.0.3
|
||||
|
||||
* Transitions internal testing from a command line lcov tool to a
|
||||
|
@ -1075,7 +1075,7 @@ class _Key {
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => hashValues(section, hashList(parts));
|
||||
int get hashCode => Object.hash(section, Object.hashAll(parts));
|
||||
}
|
||||
|
||||
class _Subscription {
|
||||
|
@ -2,7 +2,7 @@ name: rfw
|
||||
description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime."
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/rfw
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22
|
||||
version: 1.0.3
|
||||
version: 1.0.4
|
||||
|
||||
environment:
|
||||
sdk: ">=2.13.0 <3.0.0"
|
||||
|
Reference in New Issue
Block a user