Unverified Commit 3e7b2085 authored by Konstantin Scheglov's avatar Konstantin Scheglov Committed by GitHub

Fix UNNECESSARY_TYPE_CHECK_TRUE hints. (#77753)

parent 2edf6b73
...@@ -126,7 +126,6 @@ class PaintingContext extends ClipContext { ...@@ -126,7 +126,6 @@ class PaintingContext extends ClipContext {
// layer for repaint boundaries. // layer for repaint boundaries.
child._layer = childLayer = OffsetLayer(); child._layer = childLayer = OffsetLayer();
} else { } else {
assert(childLayer is OffsetLayer);
assert(debugAlsoPaintedParent || childLayer.attached); assert(debugAlsoPaintedParent || childLayer.attached);
childLayer.removeAllChildren(); childLayer.removeAllChildren();
} }
......
...@@ -465,9 +465,8 @@ class SliverConstraints extends Constraints { ...@@ -465,9 +465,8 @@ class SliverConstraints extends Constraints {
return true; return true;
if (other is! SliverConstraints) if (other is! SliverConstraints)
return false; return false;
assert(other is SliverConstraints && other.debugAssertIsValid()); assert(other.debugAssertIsValid());
return other is SliverConstraints return other.axisDirection == axisDirection
&& other.axisDirection == axisDirection
&& other.growthDirection == growthDirection && other.growthDirection == growthDirection
&& other.scrollOffset == scrollOffset && other.scrollOffset == scrollOffset
&& other.overlap == overlap && other.overlap == overlap
......
...@@ -3965,7 +3965,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -3965,7 +3965,6 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
assert(_debugCheckStateIsActiveForAncestorLookup()); assert(_debugCheckStateIsActiveForAncestorLookup());
final InheritedElement? ancestor = _inheritedWidgets == null ? null : _inheritedWidgets![T]; final InheritedElement? ancestor = _inheritedWidgets == null ? null : _inheritedWidgets![T];
if (ancestor != null) { if (ancestor != null) {
assert(ancestor is InheritedElement);
return dependOnInheritedElement(ancestor, aspect: aspect) as T; return dependOnInheritedElement(ancestor, aspect: aspect) as T;
} }
_hadUnsatisfiedDependencies = true; _hadUnsatisfiedDependencies = true;
......
...@@ -1328,7 +1328,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate { ...@@ -1328,7 +1328,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
final TapGestureRecognizer? tap = recognizers[TapGestureRecognizer] as TapGestureRecognizer?; final TapGestureRecognizer? tap = recognizers[TapGestureRecognizer] as TapGestureRecognizer?;
if (tap == null) if (tap == null)
return null; return null;
assert(tap is TapGestureRecognizer);
return () { return () {
assert(tap != null); assert(tap != null);
...@@ -1347,7 +1346,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate { ...@@ -1347,7 +1346,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
return null; return null;
return () { return () {
assert(longPress is LongPressGestureRecognizer);
if (longPress.onLongPressStart != null) if (longPress.onLongPressStart != null)
longPress.onLongPressStart!(const LongPressStartDetails()); longPress.onLongPressStart!(const LongPressStartDetails());
if (longPress.onLongPress != null) if (longPress.onLongPress != null)
...@@ -1366,7 +1364,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate { ...@@ -1366,7 +1364,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
final GestureDragUpdateCallback? horizontalHandler = horizontal == null ? final GestureDragUpdateCallback? horizontalHandler = horizontal == null ?
null : null :
(DragUpdateDetails details) { (DragUpdateDetails details) {
assert(horizontal is HorizontalDragGestureRecognizer);
if (horizontal.onDown != null) if (horizontal.onDown != null)
horizontal.onDown!(DragDownDetails()); horizontal.onDown!(DragDownDetails());
if (horizontal.onStart != null) if (horizontal.onStart != null)
...@@ -1380,7 +1377,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate { ...@@ -1380,7 +1377,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
final GestureDragUpdateCallback? panHandler = pan == null ? final GestureDragUpdateCallback? panHandler = pan == null ?
null : null :
(DragUpdateDetails details) { (DragUpdateDetails details) {
assert(pan is PanGestureRecognizer);
if (pan.onDown != null) if (pan.onDown != null)
pan.onDown!(DragDownDetails()); pan.onDown!(DragDownDetails());
if (pan.onStart != null) if (pan.onStart != null)
...@@ -1408,7 +1404,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate { ...@@ -1408,7 +1404,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
final GestureDragUpdateCallback? verticalHandler = vertical == null ? final GestureDragUpdateCallback? verticalHandler = vertical == null ?
null : null :
(DragUpdateDetails details) { (DragUpdateDetails details) {
assert(vertical is VerticalDragGestureRecognizer);
if (vertical.onDown != null) if (vertical.onDown != null)
vertical.onDown!(DragDownDetails()); vertical.onDown!(DragDownDetails());
if (vertical.onStart != null) if (vertical.onStart != null)
...@@ -1422,7 +1417,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate { ...@@ -1422,7 +1417,6 @@ class _DefaultSemanticsGestureDelegate extends SemanticsGestureDelegate {
final GestureDragUpdateCallback? panHandler = pan == null ? final GestureDragUpdateCallback? panHandler = pan == null ?
null : null :
(DragUpdateDetails details) { (DragUpdateDetails details) {
assert(pan is PanGestureRecognizer);
if (pan.onDown != null) if (pan.onDown != null)
pan.onDown!(DragDownDetails()); pan.onDown!(DragDownDetails());
if (pan.onStart != null) if (pan.onStart != null)
......
...@@ -55,7 +55,6 @@ void main() { ...@@ -55,7 +55,6 @@ void main() {
expect( expect(
() => method.decodeEnvelope(errorData), () => method.decodeEnvelope(errorData),
throwsA(predicate((PlatformException e) => throwsA(predicate((PlatformException e) =>
e is PlatformException &&
e.code == 'errorCode' && e.code == 'errorCode' &&
e.message == 'errorMessage' && e.message == 'errorMessage' &&
e.details == 'errorDetails'))); e.details == 'errorDetails')));
...@@ -71,7 +70,7 @@ void main() { ...@@ -71,7 +70,7 @@ void main() {
expect( expect(
() => method.decodeEnvelope(errorData), () => method.decodeEnvelope(errorData),
throwsA(predicate((PlatformException e) => throwsA(predicate((PlatformException e) =>
e is PlatformException && e.stacktrace == 'errorStacktrace'))); e.stacktrace == 'errorStacktrace')));
}); });
test('should allow null error message,', () { test('should allow null error message,', () {
...@@ -84,8 +83,7 @@ void main() { ...@@ -84,8 +83,7 @@ void main() {
() => method.decodeEnvelope(errorData), () => method.decodeEnvelope(errorData),
throwsA( throwsA(
predicate((PlatformException e) { predicate((PlatformException e) {
return e is PlatformException && return e.code == 'errorCode' &&
e.code == 'errorCode' &&
e.message == null && e.message == null &&
e.details == 'errorDetails'; e.details == 'errorDetails';
}), }),
...@@ -106,7 +104,6 @@ void main() { ...@@ -106,7 +104,6 @@ void main() {
expect( expect(
() => jsonMethodCodec.decodeEnvelope(errorData), () => jsonMethodCodec.decodeEnvelope(errorData),
throwsA(predicate((PlatformException e) => throwsA(predicate((PlatformException e) =>
e is PlatformException &&
e.code == 'errorCode' && e.code == 'errorCode' &&
e.message == 'errorMessage' && e.message == 'errorMessage' &&
e.details == 'errorDetails'))); e.details == 'errorDetails')));
...@@ -122,7 +119,7 @@ void main() { ...@@ -122,7 +119,7 @@ void main() {
expect( expect(
() => jsonMethodCodec.decodeEnvelope(errorData!), () => jsonMethodCodec.decodeEnvelope(errorData!),
throwsA(predicate((PlatformException e) => throwsA(predicate((PlatformException e) =>
e is PlatformException && e.stacktrace == 'errorStacktrace'))); e.stacktrace == 'errorStacktrace')));
}); });
}); });
group('JSON message codec', () { group('JSON message codec', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment