Skip to content

Commit

Permalink
Use Object as the parameter type in 'operator ==' overrides (#6916)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Dec 9, 2023
1 parent 14aa44e commit 3130056
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ScriptLocation {
final SourcePosition? location;

@override
bool operator ==(Object? other) {
bool operator ==(Object other) {
return other is ScriptLocation &&
other.scriptRef == scriptRef &&
other.location == location;
Expand Down Expand Up @@ -107,7 +107,7 @@ abstract class BreakpointAndSourcePosition
@override
int get hashCode => breakpoint.hashCode;
@override
bool operator ==(Object? other) {
bool operator ==(Object other) {
return other is BreakpointAndSourcePosition &&
other.breakpoint == breakpoint;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract class NetworkRequest with SearchableDataMixin {
String toString() => '$method $uri';

@override
bool operator ==(Object? other) {
bool operator ==(Object other) {
return other is NetworkRequest &&
runtimeType == other.runtimeType &&
startTimestamp == other.startTimestamp &&
Expand Down Expand Up @@ -174,7 +174,7 @@ class WebSocket extends NetworkRequest {
bool get inProgress => false;

@override
bool operator ==(Object? other) => other is WebSocket && id == other.id;
bool operator ==(Object other) => other is WebSocket && id == other.id;

@override
int get hashCode => id.hashCode;
Expand Down
3 changes: 1 addition & 2 deletions packages/devtools_app/lib/src/shared/charts/flame_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1443,8 +1443,7 @@ class TimelineGridPainter extends FlameChartPainter {
bool shouldRepaint(CustomPainter oldDelegate) => this != oldDelegate;

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
if (other is! TimelineGridPainter) return false;
return zoom == other.zoom &&
constraints == other.constraints &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ class SourcePosition {
final int? tokenPos;

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
return other is SourcePosition &&
other.line == line &&
other.column == column &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ class DartIOHttpRequestData extends NetworkRequest {
}

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
return other is DartIOHttpRequestData && id == other.id && super == other;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ class ThreadNameEvent {
final int? threadId;

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
return other is ThreadNameEvent &&
name == other.name &&
threadId == other.threadId;
Expand Down
9 changes: 3 additions & 6 deletions packages/devtools_app/lib/src/shared/primitives/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,7 @@ class TimeRange {
}

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
if (other is! TimeRange) return false;
return start == other.start && end == other.end;
}
Expand Down Expand Up @@ -749,8 +748,7 @@ class Range {
String toString() => 'Range($begin, $end)';

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
if (other is! Range) return false;
return begin == other.begin && end == other.end;
}
Expand Down Expand Up @@ -779,8 +777,7 @@ class LineRange {
String toString() => 'LineRange($begin, $end)';

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
if (other is! LineRange) return false;
return begin == other.begin && end == other.end;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/test/primitives/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ class _SubtractionResult {
final double? from;

@override
bool operator ==(Object? other) {
bool operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@
>
> @override
# ^^^^^^^^^ storage.type.annotation.dart
> bool operator ==(other) {
> bool operator ==(Object other) {
# ^^^^ support.class.dart
# ^^^^^^^^ keyword.declaration.dart
# ^^ keyword.operator.comparison.dart
# ^^^^^^ support.class.dart
> return false;
# ^^^^^^ keyword.control.dart
# ^^^^^ constant.language.dart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class B extends A {
set foo(String value) {}

@override
bool operator ==(other) {
bool operator ==(Object other) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ final class FlutterVersion extends SemanticVersion {
final SemanticVersion? dartSdkVersion;

@override
// ignore: avoid-dynamic, necessary here.
bool operator ==(other) {
bool operator ==(Object other) {
if (other is! FlutterVersion) return false;
return version == other.version &&
channel == other.channel &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class ConnectedState {
final bool userInitiatedConnectionState;

@override
bool operator ==(Object? other) {
bool operator ==(Object other) {
return other is ConnectedState &&
other.connected == connected &&
other.userInitiatedConnectionState == userInitiatedConnectionState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class DevToolsExtensionConfig implements Comparable {
}

@override
bool operator ==(Object? other) {
bool operator ==(Object other) {
return other is DevToolsExtensionConfig &&
other.name == name &&
other.path == path &&
Expand Down

0 comments on commit 3130056

Please sign in to comment.