Operator equals (#19303)
* use Object for operator==
* apply style guide for operator==
diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature
index 2634522..3859343 100644
--- a/ci/licenses_golden/tool_signature
+++ b/ci/licenses_golden/tool_signature
@@ -1,2 +1,2 @@
-Signature: d87fdd028d9cc76587c43c73be9d6541
+Signature: 850d87bf990697506c74c39a473e4645
diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart
index 1911a9d..2739048 100644
--- a/lib/ui/geometry.dart
+++ b/lib/ui/geometry.dart
@@ -84,7 +84,7 @@
/// left-hand-side operand are equal to the horizontal and vertical values of
/// the right-hand-side operand respectively. Returns false otherwise.
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is OffsetBase
&& other._dx == _dx
&& other._dy == _dy;
@@ -334,7 +334,7 @@
/// Compares two Offsets for equality.
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is Offset
&& other.dx == dx
&& other.dy == dy;
@@ -606,7 +606,7 @@
/// Compares two Sizes for equality.
// We don't compare the runtimeType because of _DebugSize in the framework.
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is Size
&& other._dx == _dx
&& other._dy == _dy;
@@ -887,7 +887,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (runtimeType != other.runtimeType)
@@ -1014,7 +1014,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (runtimeType != other.runtimeType)
@@ -1615,7 +1615,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (runtimeType != other.runtimeType)
diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart
index 2aaa5a0..5e704df 100644
--- a/lib/ui/painting.dart
+++ b/lib/ui/painting.dart
@@ -324,7 +324,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -2612,7 +2612,7 @@
static const int _TypeBlur = 1; // SkBlurMaskFilter
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is MaskFilter
&& other._style == _style
&& other._sigma == _sigma;
@@ -2741,7 +2741,7 @@
static const int _TypeSrgbToLinearGamma = 4; // MakeSRGBToLinearGamma
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is ColorFilter
&& other._type == _type
&& _listEquals<double>(other._matrix, _matrix)
@@ -2886,7 +2886,7 @@
static const int _kTypeMatrix = 1; // MakeMatrixFilterRowMajor255
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is ImageFilter
&& other._type == _type
&& _listEquals<double>(other._data, _data)
@@ -4398,7 +4398,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
return other is Shadow
diff --git a/lib/ui/plugins.dart b/lib/ui/plugins.dart
index 384f219..64eca6e 100644
--- a/lib/ui/plugins.dart
+++ b/lib/ui/plugins.dart
@@ -24,7 +24,7 @@
int toRawHandle() => _handle;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (runtimeType != other.runtimeType)
return false;
return other is CallbackHandle
diff --git a/lib/ui/text.dart b/lib/ui/text.dart
index 00691fb..8bdc0f0 100644
--- a/lib/ui/text.dart
+++ b/lib/ui/text.dart
@@ -298,7 +298,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -389,7 +389,7 @@
static const TextDecoration lineThrough = TextDecoration._(0x4);
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is TextDecoration
&& other._mask == _mask;
}
@@ -496,7 +496,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
return other is TextHeightBehavior
@@ -767,7 +767,7 @@
final List<FontFeature>? _fontFeatures;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
return other is TextStyle
@@ -1007,7 +1007,7 @@
final Locale? _locale;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -1186,7 +1186,7 @@
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -1350,7 +1350,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -1462,7 +1462,7 @@
final TextAffinity affinity;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
return other is TextPosition
@@ -1546,7 +1546,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
return other is TextRange
@@ -1598,7 +1598,7 @@
final double width;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
return other is ParagraphConstraints
diff --git a/lib/ui/window.dart b/lib/ui/window.dart
index d9edf7c..815bee5 100644
--- a/lib/ui/window.dart
+++ b/lib/ui/window.dart
@@ -470,7 +470,7 @@
};
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (other is! Locale) {
@@ -1300,7 +1300,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
return other is AccessibilityFeatures
diff --git a/lib/web_ui/dev/utils.dart b/lib/web_ui/dev/utils.dart
index 96633ac..798cc89 100644
--- a/lib/web_ui/dev/utils.dart
+++ b/lib/web_ui/dev/utils.dart
@@ -27,8 +27,9 @@
path.relative(_absolutePath, from: environment.webUiRootDir.path);
@override
- bool operator ==(dynamic other) {
- return other is FilePath && _absolutePath == other._absolutePath;
+ bool operator ==(Object other) {
+ return other is FilePath
+ && other._absolutePath == _absolutePath;
}
@override
diff --git a/lib/web_ui/lib/src/engine/color_filter.dart b/lib/web_ui/lib/src/engine/color_filter.dart
index 4f8c82b..3bd62e1 100644
--- a/lib/web_ui/lib/src/engine/color_filter.dart
+++ b/lib/web_ui/lib/src/engine/color_filter.dart
@@ -121,20 +121,12 @@
static const int _TypeSrgbToLinearGamma = 4; // MakeSRGBToLinearGamma
@override
- bool operator ==(dynamic other) {
- if (other is! EngineColorFilter) {
- return false;
- }
- final EngineColorFilter typedOther = other;
-
- if (_type != typedOther._type) {
- return false;
- }
- if (!_listEquals<double>(_matrix, typedOther._matrix)) {
- return false;
- }
-
- return _color == typedOther._color && _blendMode == typedOther._blendMode;
+ bool operator ==(Object other) {
+ return other is EngineColorFilter
+ && other._type == _type
+ && _listEquals<double>(other._matrix, _matrix)
+ && other._color == _color
+ && other._blendMode == _blendMode;
}
SkColorFilter? _toSkColorFilter() {
diff --git a/lib/web_ui/lib/src/engine/compositor/embedded_views.dart b/lib/web_ui/lib/src/engine/compositor/embedded_views.dart
index 4725a8d..710f0fb 100644
--- a/lib/web_ui/lib/src/engine/compositor/embedded_views.dart
+++ b/lib/web_ui/lib/src/engine/compositor/embedded_views.dart
@@ -398,18 +398,14 @@
final ui.Size size;
final MutatorsStack mutators;
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
- if (other is! EmbeddedViewParams) {
- return false;
- }
-
- EmbeddedViewParams typedOther = other;
- return offset == typedOther.offset &&
- size == typedOther.size &&
- mutators == typedOther.mutators;
+ return other is EmbeddedViewParams
+ && other.offset == offset
+ && other.size == size
+ && other.mutators == mutators;
}
int get hashCode => ui.hashValues(offset, size, mutators);
@@ -459,7 +455,7 @@
double get alphaFloat => alpha! / 255.0;
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
@@ -524,26 +520,12 @@
_mutators.removeLast();
}
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(other, this)) {
return true;
}
- if (other is! MutatorsStack) {
- return false;
- }
-
- final MutatorsStack typedOther = other;
- if (_mutators.length != typedOther._mutators.length) {
- return false;
- }
-
- for (int i = 0; i < _mutators.length; i++) {
- if (_mutators[i] != typedOther._mutators[i]) {
- return false;
- }
- }
-
- return true;
+ return other is MutatorsStack
+ && _listEquals<Mutator>(other._mutators, _mutators);
}
int get hashCode => ui.hashList(_mutators);
diff --git a/lib/web_ui/lib/src/engine/compositor/image_filter.dart b/lib/web_ui/lib/src/engine/compositor/image_filter.dart
index 76aed37..af54713 100644
--- a/lib/web_ui/lib/src/engine/compositor/image_filter.dart
+++ b/lib/web_ui/lib/src/engine/compositor/image_filter.dart
@@ -32,12 +32,10 @@
);
@override
- bool operator ==(dynamic other) {
- if (other is! SkImageFilter) {
- return false;
- }
- final SkImageFilter typedOther = other;
- return _sigmaX == typedOther._sigmaX && _sigmaY == typedOther._sigmaY;
+ bool operator ==(Object other) {
+ return other is SkImageFilter
+ && other._sigmaX == _sigmaX
+ && other._sigmaY == _sigmaY;
}
@override
diff --git a/lib/web_ui/lib/src/engine/shader.dart b/lib/web_ui/lib/src/engine/shader.dart
index cdce61d..82d2f5b 100644
--- a/lib/web_ui/lib/src/engine/shader.dart
+++ b/lib/web_ui/lib/src/engine/shader.dart
@@ -278,12 +278,10 @@
final double sigmaY;
@override
- bool operator ==(dynamic other) {
- if (other is! EngineImageFilter) {
- return false;
- }
- final EngineImageFilter typedOther = other;
- return sigmaX == typedOther.sigmaX && sigmaY == typedOther.sigmaY;
+ bool operator ==(Object other) {
+ return other is EngineImageFilter
+ && other.sigmaX == sigmaX
+ && other.sigmaY == sigmaY;
}
@override
diff --git a/lib/web_ui/lib/src/engine/text/paragraph.dart b/lib/web_ui/lib/src/engine/text/paragraph.dart
index 4903f33..a40ae99 100644
--- a/lib/web_ui/lib/src/engine/text/paragraph.dart
+++ b/lib/web_ui/lib/src/engine/text/paragraph.dart
@@ -103,27 +103,26 @@
);
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
-
if (other.runtimeType != runtimeType) {
return false;
}
- final EngineLineMetrics typedOther = other;
- return displayText == typedOther.displayText &&
- startIndex == typedOther.startIndex &&
- endIndex == typedOther.endIndex &&
- hardBreak == typedOther.hardBreak &&
- ascent == typedOther.ascent &&
- descent == typedOther.descent &&
- unscaledAscent == typedOther.unscaledAscent &&
- height == typedOther.height &&
- width == typedOther.width &&
- left == typedOther.left &&
- baseline == typedOther.baseline &&
- lineNumber == typedOther.lineNumber;
+ return other is EngineLineMetrics
+ && other.displayText == displayText
+ && other.startIndex == startIndex
+ && other.endIndex == endIndex
+ && other.hardBreak == hardBreak
+ && other.ascent == ascent
+ && other.descent == descent
+ && other.unscaledAscent == unscaledAscent
+ && other.height == height
+ && other.width == width
+ && other.left == left
+ && other.baseline == baseline
+ && other.lineNumber == lineNumber;
}
@override
@@ -687,25 +686,25 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- final EngineParagraphStyle typedOther = other;
- return _textAlign == typedOther._textAlign ||
- _textDirection == typedOther._textDirection ||
- _fontWeight == typedOther._fontWeight ||
- _fontStyle == typedOther._fontStyle ||
- _maxLines == typedOther._maxLines ||
- _fontFamily == typedOther._fontFamily ||
- _fontSize == typedOther._fontSize ||
- _height == typedOther._height ||
- _textHeightBehavior == typedOther._textHeightBehavior ||
- _ellipsis == typedOther._ellipsis ||
- _locale == typedOther._locale;
+ return other is EngineParagraphStyle
+ && other._textAlign == _textAlign
+ && other._textDirection == _textDirection
+ && other._fontWeight == _fontWeight
+ && other._fontStyle == _fontStyle
+ && other._maxLines == _maxLines
+ && other._fontFamily == _fontFamily
+ && other._fontSize == _fontSize
+ && other._height == _height
+ && other._textHeightBehavior == _textHeightBehavior
+ && other._ellipsis == _ellipsis
+ && other._locale == _locale;
}
@override
@@ -830,32 +829,31 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- final EngineTextStyle typedOther = other;
- return _color == typedOther._color &&
- _decoration == typedOther._decoration &&
- _decorationColor == typedOther._decorationColor &&
- _decorationStyle == typedOther._decorationStyle &&
- _fontWeight == typedOther._fontWeight &&
- _fontStyle == typedOther._fontStyle &&
- _textBaseline == typedOther._textBaseline &&
- _fontFamily == typedOther._fontFamily &&
- _fontSize == typedOther._fontSize &&
- _letterSpacing == typedOther._letterSpacing &&
- _wordSpacing == typedOther._wordSpacing &&
- _height == typedOther._height &&
- _locale == typedOther._locale &&
- _background == typedOther._background &&
- _foreground == typedOther._foreground &&
- _listEquals<ui.Shadow>(_shadows, typedOther._shadows) &&
- _listEquals<String>(
- _fontFamilyFallback, typedOther._fontFamilyFallback);
+ return other is EngineTextStyle
+ && other._color == _color
+ && other._decoration == _decoration
+ && other._decorationColor == _decorationColor
+ && other._decorationStyle == _decorationStyle
+ && other._fontWeight == _fontWeight
+ && other._fontStyle == _fontStyle
+ && other._textBaseline == _textBaseline
+ && other._fontFamily == _fontFamily
+ && other._fontSize == _fontSize
+ && other._letterSpacing == _letterSpacing
+ && other._wordSpacing == _wordSpacing
+ && other._height == _height
+ && other._locale == _locale
+ && other._background == _background
+ && other._foreground == _foreground
+ && _listEquals<ui.Shadow>(other._shadows, _shadows)
+ && _listEquals<String>(other._fontFamilyFallback, _fontFamilyFallback);
}
@override
@@ -975,23 +973,22 @@
final bool? _forceStrutHeight;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- final EngineStrutStyle typedOther = other;
- return _fontFamily == typedOther._fontFamily &&
- _fontSize == typedOther._fontSize &&
- _height == typedOther._height &&
- _leading == typedOther._leading &&
- _fontWeight == typedOther._fontWeight &&
- _fontStyle == typedOther._fontStyle &&
- _forceStrutHeight == typedOther._forceStrutHeight &&
- _listEquals<String>(
- _fontFamilyFallback, typedOther._fontFamilyFallback);
+ return other is EngineStrutStyle
+ && other._fontFamily == _fontFamily
+ && other._fontSize == _fontSize
+ && other._height == _height
+ && other._leading == _leading
+ && other._fontWeight == _fontWeight
+ && other._fontStyle == _fontStyle
+ && other._forceStrutHeight == _forceStrutHeight
+ && _listEquals<String>(other._fontFamilyFallback, _fontFamilyFallback);
}
@override
diff --git a/lib/web_ui/lib/src/engine/text/ruler.dart b/lib/web_ui/lib/src/engine/text/ruler.dart
index 74080b0..6199168 100644
--- a/lib/web_ui/lib/src/engine/text/ruler.dart
+++ b/lib/web_ui/lib/src/engine/text/ruler.dart
@@ -95,24 +95,24 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- final ParagraphGeometricStyle typedOther = other;
- return fontWeight == typedOther.fontWeight &&
- fontStyle == typedOther.fontStyle &&
- fontFamily == typedOther.fontFamily &&
- fontSize == typedOther.fontSize &&
- lineHeight == typedOther.lineHeight &&
- maxLines == typedOther.maxLines &&
- letterSpacing == typedOther.letterSpacing &&
- wordSpacing == typedOther.wordSpacing &&
- decoration == typedOther.decoration &&
- ellipsis == typedOther.ellipsis;
+ return other is ParagraphGeometricStyle
+ && other.fontWeight == fontWeight
+ && other.fontStyle == fontStyle
+ && other.fontFamily == fontFamily
+ && other.fontSize == fontSize
+ && other.lineHeight == lineHeight
+ && other.maxLines == maxLines
+ && other.letterSpacing == letterSpacing
+ && other.wordSpacing == wordSpacing
+ && other.decoration == decoration
+ && other.ellipsis == ellipsis;
}
@override
diff --git a/lib/web_ui/lib/src/engine/text_editing/text_editing.dart b/lib/web_ui/lib/src/engine/text_editing/text_editing.dart
index abc9f4c..4447473 100644
--- a/lib/web_ui/lib/src/engine/text_editing/text_editing.dart
+++ b/lib/web_ui/lib/src/engine/text_editing/text_editing.dart
@@ -345,17 +345,17 @@
int get hashCode => ui.hashValues(text, baseOffset, extentOffset);
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (runtimeType != other.runtimeType) {
return false;
}
- final EditingState typedOther = other;
- return text == typedOther.text &&
- baseOffset == typedOther.baseOffset &&
- extentOffset == typedOther.extentOffset;
+ return other is EditingState
+ && other.text == text
+ && other.baseOffset == baseOffset
+ && other.extentOffset == extentOffset;
}
@override
diff --git a/lib/web_ui/lib/src/ui/geometry.dart b/lib/web_ui/lib/src/ui/geometry.dart
index 5e069c2..904cec0 100644
--- a/lib/web_ui/lib/src/ui/geometry.dart
+++ b/lib/web_ui/lib/src/ui/geometry.dart
@@ -83,7 +83,7 @@
/// left-hand-side operand are equal to the horizontal and vertical values of
/// the right-hand-side operand respectively. Returns false otherwise.
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is OffsetBase
&& other._dx == _dx
&& other._dy == _dy;
@@ -333,7 +333,7 @@
/// Compares two Offsets for equality.
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is Offset
&& other.dx == dx
&& other.dy == dy;
@@ -605,7 +605,7 @@
/// Compares two Sizes for equality.
// We don't compare the runtimeType because of _DebugSize in the framework.
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
return other is Size
&& other._dx == _dx
&& other._dy == _dy;
@@ -883,7 +883,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (runtimeType != other.runtimeType)
@@ -1010,7 +1010,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (runtimeType != other.runtimeType)
@@ -1620,7 +1620,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (runtimeType != other.runtimeType)
diff --git a/lib/web_ui/lib/src/ui/painting.dart b/lib/web_ui/lib/src/ui/painting.dart
index 0facfae..ce19fc8 100644
--- a/lib/web_ui/lib/src/ui/painting.dart
+++ b/lib/web_ui/lib/src/ui/painting.dart
@@ -239,15 +239,15 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- final Color typedOther = other;
- return value == typedOther.value;
+ return other is Color
+ && other.value == value;
}
@override
@@ -1382,12 +1382,10 @@
BlurStyle get webOnlyBlurStyle => _style;
@override
- bool operator ==(dynamic other) {
- if (other is! MaskFilter) {
- return false;
- }
- final MaskFilter typedOther = other;
- return _style == typedOther._style && _sigma == typedOther._sigma;
+ bool operator ==(Object other) {
+ return other is MaskFilter
+ && other._style == _style
+ && other._sigma == _sigma;
}
@override
@@ -1810,17 +1808,14 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
- if (other is! Shadow) {
- return false;
- }
- final Shadow typedOther = other;
- return color == typedOther.color &&
- offset == typedOther.offset &&
- blurRadius == typedOther.blurRadius;
+ return other is Shadow
+ && other.color == color
+ && other.offset == offset
+ && other.blurRadius == blurRadius;
}
@override
diff --git a/lib/web_ui/lib/src/ui/text.dart b/lib/web_ui/lib/src/ui/text.dart
index 9fe24e7..9800cd3 100644
--- a/lib/web_ui/lib/src/ui/text.dart
+++ b/lib/web_ui/lib/src/ui/text.dart
@@ -280,15 +280,16 @@
final int value;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- final FontFeature typedOther = other;
- return feature == typedOther.feature && value == typedOther.value;
+ return other is FontFeature
+ && other.feature == feature
+ && other.value == value;
}
@override
@@ -373,12 +374,9 @@
static const TextDecoration lineThrough = TextDecoration._(0x4);
@override
- bool operator ==(dynamic other) {
- if (other is! TextDecoration) {
- return false;
- }
- final TextDecoration typedOther = other;
- return _mask == typedOther._mask;
+ bool operator ==(Object other) {
+ return other is TextDecoration
+ && other._mask == _mask;
}
@override
@@ -486,7 +484,7 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType)
return false;
return other is TextHeightBehavior
@@ -907,19 +905,19 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- final TextBox typedOther = other;
- return typedOther.left == left &&
- typedOther.top == top &&
- typedOther.right == right &&
- typedOther.bottom == bottom &&
- typedOther.direction == direction;
+ return other is TextBox
+ && other.left == left
+ && other.top == top
+ && other.right == right
+ && other.bottom == bottom
+ && other.direction == direction;
}
@override
@@ -1023,12 +1021,13 @@
final TextAffinity affinity;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
- final TextPosition typedOther = other;
- return typedOther.offset == offset && typedOther.affinity == affinity;
+ return other is TextPosition
+ && other.offset == offset
+ && other.affinity == affinity;
}
@override
@@ -1104,15 +1103,13 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
- if (other is! TextRange) {
- return false;
- }
- final TextRange typedOther = other;
- return typedOther.start == start && typedOther.end == end;
+ return other is TextRange
+ && other.start == start
+ && other.end == end;
}
@override
@@ -1159,12 +1156,12 @@
final double width;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
- final ParagraphConstraints typedOther = other;
- return typedOther.width == width;
+ return other is ParagraphConstraints
+ && other.width == width;
}
@override
diff --git a/lib/web_ui/lib/src/ui/window.dart b/lib/web_ui/lib/src/ui/window.dart
index aab9bdc..557e6aa 100644
--- a/lib/web_ui/lib/src/ui/window.dart
+++ b/lib/web_ui/lib/src/ui/window.dart
@@ -375,17 +375,14 @@
};
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
- if (other is! Locale) {
- return false;
- }
- final Locale typedOther = other;
- return languageCode == typedOther.languageCode &&
- scriptCode == typedOther.scriptCode &&
- countryCode == typedOther.countryCode;
+ return other is Locale
+ && other.languageCode == languageCode
+ && other.scriptCode == scriptCode
+ && other.countryCode == countryCode;
}
@override
@@ -926,12 +923,12 @@
}
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
- final AccessibilityFeatures typedOther = other;
- return _index == typedOther._index;
+ return other is AccessibilityFeatures
+ && other._index == _index;
}
@override
diff --git a/lib/web_ui/test/engine/profiler_test.dart b/lib/web_ui/test/engine/profiler_test.dart
index 04d580d..0314ee9 100644
--- a/lib/web_ui/test/engine/profiler_test.dart
+++ b/lib/web_ui/test/engine/profiler_test.dart
@@ -78,14 +78,16 @@
int get hashCode => hashValues(name, value);
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
- return name == other.name && value == other.value;
+ return other is BenchmarkDatapoint
+ && other.name == name
+ && other.value == value;
}
@override
diff --git a/lib/web_ui/test/text/line_breaker_test.dart b/lib/web_ui/test/text/line_breaker_test.dart
index 5025552..0737469 100644
--- a/lib/web_ui/test/text/line_breaker_test.dart
+++ b/lib/web_ui/test/text/line_breaker_test.dart
@@ -173,8 +173,10 @@
int get hashCode => hashValues(text, breakType);
@override
- bool operator ==(dynamic other) {
- return other is Line && text == other.text && breakType == other.breakType;
+ bool operator ==(Object other) {
+ return other is Line
+ && other.text == text
+ && other.breakType == breakType;
}
String get escapedText {
diff --git a/shell/platform/fuchsia/dart-pkg/zircon/lib/src/handle.dart b/shell/platform/fuchsia/dart-pkg/zircon/lib/src/handle.dart
index 277afae..99b18d7 100644
--- a/shell/platform/fuchsia/dart-pkg/zircon/lib/src/handle.dart
+++ b/shell/platform/fuchsia/dart-pkg/zircon/lib/src/handle.dart
@@ -26,8 +26,10 @@
String toString() => 'Handle($handle)';
@override
- bool operator ==(Object other) =>
- (other is Handle) && (handle == other.handle);
+ bool operator ==(Object other) {
+ return other is Handle
+ && other.handle == handle;
+ }
@override
int get hashCode => handle.hashCode;
diff --git a/tools/licenses/lib/cache.dart b/tools/licenses/lib/cache.dart
index 62dcbee..043158b 100644
--- a/tools/licenses/lib/cache.dart
+++ b/tools/licenses/lib/cache.dart
@@ -25,13 +25,13 @@
final dynamic _value;
@override
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
if (identical(this, other))
return true;
if (runtimeType != other.runtimeType)
return false;
- final Key typedOther = other;
- return _value == typedOther._value;
+ return other is Key
+ && other._value == _value;
}
@override