Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/flutter_image/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.1.2

- Migrates from `ui.hash*` to `Object.hash*`.

## 4.1.1

* Updates package description.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_image/lib/network.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)';
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_image/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 8 additions & 4 deletions packages/flutter_markdown/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
## 0.6.10+2

* Migrates from `ui.hash*` to `Object.hash*`.

## 0.6.10+1

* Updates Linux example to remove unneeded library dependencies that
* Updates Linux example to remove unneeded library dependencies that
could cause build failures.
* Updates for non-nullable bindings.
* Updates for non-nullable bindings.

## 0.6.10

Expand All @@ -14,11 +18,11 @@

## 0.6.9

* Leading spaces in a paragraph and in list items are now ignored according to [GFM #192](https://github.github.com/gfm/#example-192) and [GFM #236](https://github.github.com/gfm/#example-236).
* Leading spaces in a paragraph and in list items are now ignored according to [GFM #192](https://github.github.com/gfm/#example-192) and [GFM #236](https://github.github.com/gfm/#example-236).

## 0.6.8

* Added option paddingBuilders
* Added option paddingBuilders

## 0.6.7

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_markdown/lib/src/style_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_markdown/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions packages/multicast_dns/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.2+1

* Migrates from `ui.hash*` to `Object.hash*`.

## 0.3.2

* Updates package description.
Expand Down
91 changes: 29 additions & 62 deletions packages/multicast_dns/lib/src/resource_record.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions packages/multicast_dns/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/multicast_dns/test/decode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void testValidPackages() {
domainName: '______________________._______________.____._____',
),
TxtResourceRecord(
'_______________.____._____',
'______________________.____________.____._____',
result[1].validUntil,
text: 'model=MacBookPro14,3\nosxvers=18\necolor=225,225,223\n',
),
Expand All @@ -176,7 +176,7 @@ void testValidPackages() {
domainName: '______________________._______________.____._____',
),
TxtResourceRecord(
'_______________.____._____',
'______________________.____________.____._____',
result[1].validUntil,
text: (')' * 129) + '\n',
),
Expand Down
4 changes: 4 additions & 0 deletions packages/palette_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.3+1

* Migrates from `ui.hash*` to `Object.hash*`.

## 0.3.3

* Avoids dynamic calls in equality checks.
Expand Down
6 changes: 2 additions & 4 deletions packages/palette_generator/lib/palette_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ class PaletteTarget with Diagnosticable {

@override
int get hashCode {
return hashValues(
return Object.hash(
minimumSaturation,
targetSaturation,
maximumSaturation,
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/palette_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ 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"
sdk: ">=2.14.0 <3.0.0"
flutter: ">=1.15.21"

dependencies:
Expand Down
4 changes: 4 additions & 0 deletions packages/rfw/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/rfw/lib/src/flutter/runtime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/rfw/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down