From dc106ddb9c8d9eb77db60ba3ade50676c63331aa Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 24 Mar 2021 12:40:08 -0700 Subject: [PATCH] remove ignores --- ci/licenses_golden/tool_signature | 2 +- .../platform_messages_integration.dart | 2 - lib/ui/compositing.dart | 19 +- lib/ui/geometry.dart | 46 ++-- lib/ui/hooks.dart | 8 +- lib/ui/isolate_name_server.dart | 8 +- lib/ui/painting.dart | 210 ++++++++---------- lib/ui/platform_dispatcher.dart | 6 +- lib/ui/plugins.dart | 6 +- lib/ui/pointer.dart | 2 +- lib/ui/semantics.dart | 9 +- lib/ui/text.dart | 22 +- shell/platform/embedder/fixtures/main.dart | 4 +- .../dart-pkg/zircon/lib/src/handle.dart | 4 +- .../dart-pkg/zircon/lib/src/system.dart | 4 +- .../dart/window_hooks_integration_test.dart | 2 +- .../const_finder/test/const_finder_test.dart | 8 +- .../test/fixtures/lib/consts.dart | 3 - .../test/fixtures/lib/consts_and_non.dart | 4 - .../test/fixtures/pkg/package.dart | 1 - .../bin/generate_from_legacy.dart | 2 +- tools/licenses/lib/licenses.dart | 2 +- .../web_engine_tester/lib/golden_tester.dart | 1 - 23 files changed, 174 insertions(+), 201 deletions(-) diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index 4a2cf7a9896c1..b6fb376a1f54a 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: f2b15cda839d356d1d2a906e432770d6 +Signature: 249aeecf2b9a309a2b26c2be6cd18b12 diff --git a/e2etests/web/regular_integration_tests/test_driver/platform_messages_integration.dart b/e2etests/web/regular_integration_tests/test_driver/platform_messages_integration.dart index c20e91163d82c..00d33f6918b77 100644 --- a/e2etests/web/regular_integration_tests/test_driver/platform_messages_integration.dart +++ b/e2etests/web/regular_integration_tests/test_driver/platform_messages_integration.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'dart:html' as html; -// ignore: undefined_shown_name import 'dart:ui' as ui show platformViewRegistry; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -37,7 +36,6 @@ void main() async { int viewInstanceCount = 0; platformViewsRegistry.getNextPlatformViewId(); - // ignore: undefined_prefixed_name ui.platformViewRegistry.registerViewFactory('MyView', (int viewId) { ++viewInstanceCount; return html.DivElement(); diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index f2bd5473380f5..56c2bdfab2c63 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -339,7 +339,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { Clip clipBehavior = Clip.antiAlias, ClipRectEngineLayer? oldLayer, }) { - assert(clipBehavior != null); // ignore: unnecessary_null_comparison + assert(clipBehavior != null); assert(clipBehavior != Clip.none); assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushClipRect')); final EngineLayer engineLayer = EngineLayer._(); @@ -368,7 +368,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { Clip clipBehavior = Clip.antiAlias, ClipRRectEngineLayer? oldLayer, }) { - assert(clipBehavior != null); // ignore: unnecessary_null_comparison + assert(clipBehavior != null); assert(clipBehavior != Clip.none); assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushClipRRect')); final EngineLayer engineLayer = EngineLayer._(); @@ -396,7 +396,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { Clip clipBehavior = Clip.antiAlias, ClipPathEngineLayer? oldLayer, }) { - assert(clipBehavior != null); // ignore: unnecessary_null_comparison + assert(clipBehavior != null); assert(clipBehavior != Clip.none); assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushClipPath')); final EngineLayer engineLayer = EngineLayer._(); @@ -451,10 +451,10 @@ class SceneBuilder extends NativeFieldWrapperClass2 { ColorFilter filter, { ColorFilterEngineLayer? oldLayer, }) { - assert(filter != null); // ignore: unnecessary_null_comparison + assert(filter != null); assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushColorFilter')); final _ColorFilter nativeFilter = filter._toNativeColorFilter()!; - assert(nativeFilter != null); // ignore: unnecessary_null_comparison + assert(nativeFilter != null); final EngineLayer engineLayer = EngineLayer._(); _pushColorFilter(engineLayer, nativeFilter, oldLayer?._nativeLayer); final ColorFilterEngineLayer layer = ColorFilterEngineLayer._(engineLayer); @@ -479,10 +479,10 @@ class SceneBuilder extends NativeFieldWrapperClass2 { ImageFilter filter, { ImageFilterEngineLayer? oldLayer, }) { - assert(filter != null); // ignore: unnecessary_null_comparison + assert(filter != null); assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, 'pushImageFilter')); final _ImageFilter nativeFilter = filter._toNativeImageFilter(); - assert(nativeFilter != null); // ignore: unnecessary_null_comparison + assert(nativeFilter != null); final EngineLayer engineLayer = EngineLayer._(); _pushImageFilter(engineLayer, nativeFilter, oldLayer?._nativeLayer); final ImageFilterEngineLayer layer = ImageFilterEngineLayer._(engineLayer); @@ -577,7 +577,6 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// {@macro dart.ui.sceneBuilder.oldLayerVsRetained} /// /// See [pop] for details about the operation stack, and [Clip] for different clip modes. - // ignore: deprecated_member_use PhysicalShapeEngineLayer? pushPhysicalShape({ required Path path, required double elevation, @@ -727,7 +726,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { bool freeze = false, FilterQuality filterQuality = FilterQuality.low, }) { - assert(offset != null, 'Offset argument was null'); // ignore: unnecessary_null_comparison + assert(offset != null, 'Offset argument was null'); _addTexture(offset.dx, offset.dy, width, height, textureId, freeze, filterQuality.index); } @@ -756,7 +755,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { double width = 0.0, double height = 0.0, }) { - assert(offset != null, 'Offset argument was null'); // ignore: unnecessary_null_comparison + assert(offset != null, 'Offset argument was null'); _addPlatformView(offset.dx, offset.dy, width, height, viewId); } diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart index 527b6db0f646f..e273ec8bc0514 100644 --- a/lib/ui/geometry.dart +++ b/lib/ui/geometry.dart @@ -15,8 +15,8 @@ abstract class OffsetBase { /// The first argument sets the horizontal component, and the second the /// vertical component. const OffsetBase(this._dx, this._dy) - : assert(_dx != null), // ignore: unnecessary_null_comparison - assert(_dy != null); // ignore: unnecessary_null_comparison + : assert(_dx != null), + assert(_dy != null); final double _dx; final double _dy; @@ -316,7 +316,7 @@ class Offset extends OffsetBase { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. static Offset? lerp(Offset? a, Offset? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (b == null) { if (a == null) { return null; @@ -587,7 +587,7 @@ class Size extends OffsetBase { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. static Size? lerp(Size? a, Size? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (b == null) { if (a == null) { return null; @@ -632,10 +632,10 @@ class Rect { /// Construct a rectangle from its left, top, right, and bottom edges. @pragma('vm:entry-point') const Rect.fromLTRB(this.left, this.top, this.right, this.bottom) - : assert(left != null), // ignore: unnecessary_null_comparison - assert(top != null), // ignore: unnecessary_null_comparison - assert(right != null), // ignore: unnecessary_null_comparison - assert(bottom != null); // ignore: unnecessary_null_comparison + : assert(left != null), + assert(top != null), + assert(right != null), + assert(bottom != null); /// Construct a rectangle from its left and top edges, its width, and its /// height. @@ -864,7 +864,7 @@ class Rect { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. static Rect? lerp(Rect? a, Rect? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (b == null) { if (a == null) { return null; @@ -993,7 +993,7 @@ class Radius { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. static Radius? lerp(Radius? a, Radius? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (b == null) { if (a == null) { return null; @@ -1179,18 +1179,18 @@ class RRect { this.brRadiusY = 0.0, this.blRadiusX = 0.0, this.blRadiusY = 0.0, - }) : assert(left != null), // ignore: unnecessary_null_comparison - assert(top != null), // ignore: unnecessary_null_comparison - assert(right != null), // ignore: unnecessary_null_comparison - assert(bottom != null), // ignore: unnecessary_null_comparison - assert(tlRadiusX != null), // ignore: unnecessary_null_comparison - assert(tlRadiusY != null), // ignore: unnecessary_null_comparison - assert(trRadiusX != null), // ignore: unnecessary_null_comparison - assert(trRadiusY != null), // ignore: unnecessary_null_comparison - assert(brRadiusX != null), // ignore: unnecessary_null_comparison - assert(brRadiusY != null), // ignore: unnecessary_null_comparison - assert(blRadiusX != null), // ignore: unnecessary_null_comparison - assert(blRadiusY != null); // ignore: unnecessary_null_comparison + }) : assert(left != null), + assert(top != null), + assert(right != null), + assert(bottom != null), + assert(tlRadiusX != null), + assert(tlRadiusY != null), + assert(trRadiusX != null), + assert(trRadiusY != null), + assert(brRadiusX != null), + assert(brRadiusY != null), + assert(blRadiusX != null), + assert(blRadiusY != null); Float32List get _value32 => Float32List.fromList([ left, @@ -1558,7 +1558,7 @@ class RRect { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. static RRect? lerp(RRect? a, RRect? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (b == null) { if (a == null) { return null; diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index cd1746f401d74..79299a60ed3aa 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -155,7 +155,7 @@ void _invoke(void Function()? callback, Zone zone) { return; } - assert(zone != null); // ignore: unnecessary_null_comparison + assert(zone != null); if (identical(zone, Zone.current)) { callback(); @@ -174,7 +174,7 @@ void _invoke1(void Function(A a)? callback, Zone zone, A arg) { return; } - assert(zone != null); // ignore: unnecessary_null_comparison + assert(zone != null); if (identical(zone, Zone.current)) { callback(arg); @@ -193,7 +193,7 @@ void _invoke2(void Function(A1 a1, A2 a2)? callback, Zone zone, A1 arg1, return; } - assert(zone != null); // ignore: unnecessary_null_comparison + assert(zone != null); if (identical(zone, Zone.current)) { callback(arg1, arg2); @@ -214,7 +214,7 @@ void _invoke3(void Function(A1 a1, A2 a2, A3 a3)? callback, Zone zon return; } - assert(zone != null); // ignore: unnecessary_null_comparison + assert(zone != null); if (identical(zone, Zone.current)) { callback(arg1, arg2, arg3); diff --git a/lib/ui/isolate_name_server.dart b/lib/ui/isolate_name_server.dart index 55c6a481eb3fd..c2ef18b3a5830 100644 --- a/lib/ui/isolate_name_server.dart +++ b/lib/ui/isolate_name_server.dart @@ -33,7 +33,7 @@ class IsolateNameServer { /// /// The `name` argument must not be null. static SendPort? lookupPortByName(String name) { - assert(name != null, "'name' cannot be null."); // ignore: unnecessary_null_comparison + assert(name != null, "'name' cannot be null."); return _lookupPortByName(name); } @@ -51,8 +51,8 @@ class IsolateNameServer { /// /// The `port` and `name` arguments must not be null. static bool registerPortWithName(SendPort port, String name) { - assert(port != null, "'port' cannot be null."); // ignore: unnecessary_null_comparison - assert(name != null, "'name' cannot be null."); // ignore: unnecessary_null_comparison + assert(port != null, "'port' cannot be null."); + assert(name != null, "'name' cannot be null."); return _registerPortWithName(port, name); } @@ -68,7 +68,7 @@ class IsolateNameServer { /// /// The `name` argument must not be null. static bool removePortNameMapping(String name) { - assert(name != null, "'name' cannot be null."); // ignore: unnecessary_null_comparison + assert(name != null, "'name' cannot be null."); return _removePortNameMapping(name); } diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index c8178fe7b2d3f..7799d588d8e99 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -36,32 +36,32 @@ part of dart.ui; /// {@endtemplate} bool _rectIsValid(Rect rect) { - assert(rect != null, 'Rect argument was null.'); // ignore: unnecessary_null_comparison + assert(rect != null, 'Rect argument was null.'); assert(!rect.hasNaN, 'Rect argument contained a NaN value.'); return true; } bool _rrectIsValid(RRect rrect) { - assert(rrect != null, 'RRect argument was null.'); // ignore: unnecessary_null_comparison + assert(rrect != null, 'RRect argument was null.'); assert(!rrect.hasNaN, 'RRect argument contained a NaN value.'); return true; } bool _offsetIsValid(Offset offset) { - assert(offset != null, 'Offset argument was null.'); // ignore: unnecessary_null_comparison + assert(offset != null, 'Offset argument was null.'); assert(!offset.dx.isNaN && !offset.dy.isNaN, 'Offset argument contained a NaN value.'); return true; } bool _matrix4IsValid(Float64List matrix4) { - assert(matrix4 != null, 'Matrix4 argument was null.'); // ignore: unnecessary_null_comparison + assert(matrix4 != null, 'Matrix4 argument was null.'); assert(matrix4.length == 16, 'Matrix4 must have 16 entries.'); assert(matrix4.every((double value) => value.isFinite), 'Matrix4 entries must be finite.'); return true; } bool _radiusIsValid(Radius radius) { - assert(radius != null, 'Radius argument was null.'); // ignore: unnecessary_null_comparison + assert(radius != null, 'Radius argument was null.'); assert(!radius.x.isNaN && !radius.y.isNaN, 'Radius argument contained a NaN value.'); return true; } @@ -271,7 +271,7 @@ class Color { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. static Color? lerp(Color? a, Color? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (b == null) { if (a == null) { return null; @@ -331,7 +331,7 @@ class Color { /// /// The [opacity] value may not be null. static int getAlphaFromOpacity(double opacity) { - assert(opacity != null); // ignore: unnecessary_null_comparison + assert(opacity != null); return (opacity.clamp(0.0, 1.0) * 255).round(); } @@ -1187,7 +1187,7 @@ class Paint { return Color(encoded ^ _kColorDefault); } set color(Color value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final int encoded = value.value ^ _kColorDefault; _data.setInt32(_kColorOffset, encoded, _kFakeHostEndian); } @@ -1218,7 +1218,7 @@ class Paint { return BlendMode.values[encoded ^ _kBlendModeDefault]; } set blendMode(BlendMode value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final int encoded = value.index ^ _kBlendModeDefault; _data.setInt32(_kBlendModeOffset, encoded, _kFakeHostEndian); } @@ -1230,7 +1230,7 @@ class Paint { return PaintingStyle.values[_data.getInt32(_kStyleOffset, _kFakeHostEndian)]; } set style(PaintingStyle value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final int encoded = value.index; _data.setInt32(_kStyleOffset, encoded, _kFakeHostEndian); } @@ -1244,7 +1244,7 @@ class Paint { return _data.getFloat32(_kStrokeWidthOffset, _kFakeHostEndian); } set strokeWidth(double value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final double encoded = value; _data.setFloat32(_kStrokeWidthOffset, encoded, _kFakeHostEndian); } @@ -1257,7 +1257,7 @@ class Paint { return StrokeCap.values[_data.getInt32(_kStrokeCapOffset, _kFakeHostEndian)]; } set strokeCap(StrokeCap value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final int encoded = value.index; _data.setInt32(_kStrokeCapOffset, encoded, _kFakeHostEndian); } @@ -1291,7 +1291,7 @@ class Paint { return StrokeJoin.values[_data.getInt32(_kStrokeJoinOffset, _kFakeHostEndian)]; } set strokeJoin(StrokeJoin value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final int encoded = value.index; _data.setInt32(_kStrokeJoinOffset, encoded, _kFakeHostEndian); } @@ -1329,7 +1329,7 @@ class Paint { return _data.getFloat32(_kStrokeMiterLimitOffset, _kFakeHostEndian); } set strokeMiterLimit(double value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final double encoded = value - _kStrokeMiterLimitDefault; _data.setFloat32(_kStrokeMiterLimitOffset, encoded, _kFakeHostEndian); } @@ -1374,7 +1374,7 @@ class Paint { return FilterQuality.values[_data.getInt32(_kFilterQualityOffset, _kFakeHostEndian)]; } set filterQuality(FilterQuality value) { - assert(value != null); // ignore: unnecessary_null_comparison + assert(value != null); final int encoded = value.index; _data.setInt32(_kFilterQualityOffset, encoded, _kFakeHostEndian); } @@ -2442,7 +2442,7 @@ class Path extends NativeFieldWrapperClass2 { /// /// The `points` argument is interpreted as offsets from the origin. void addPolygon(List points, bool close) { - assert(points != null); // ignore: unnecessary_null_comparison + assert(points != null); _addPolygon(_encodePointList(points), close); } void _addPolygon(Float32List points, bool close) native 'Path_addPolygon'; @@ -2463,7 +2463,6 @@ class Path extends NativeFieldWrapperClass2 { /// after the matrix is translated by the given offset. The matrix is a 4x4 /// matrix stored in column major order. void addPath(Path path, Offset offset, {Float64List? matrix4}) { - // ignore: unnecessary_null_comparison assert(path != null); // path is checked on the engine side assert(_offsetIsValid(offset)); if (matrix4 != null) { @@ -2483,7 +2482,6 @@ class Path extends NativeFieldWrapperClass2 { /// after the matrix is translated by the given `offset`. The matrix is a 4x4 /// matrix stored in column major order. void extendWithPath(Path path, Offset offset, {Float64List? matrix4}) { - // ignore: unnecessary_null_comparison assert(path != null); // path is checked on the engine side assert(_offsetIsValid(offset)); if (matrix4 != null) { @@ -2566,8 +2564,8 @@ class Path extends NativeFieldWrapperClass2 { /// curve order is reduced where possible so that cubics may be turned into /// quadratics, and quadratics maybe turned into lines. static Path combine(PathOperation operation, Path path1, Path path2) { - assert(path1 != null); // ignore: unnecessary_null_comparison - assert(path2 != null); // ignore: unnecessary_null_comparison + assert(path1 != null); + assert(path2 != null); final Path path = Path(); if (path._op(path1, path2, operation.index)) { return path; @@ -2621,8 +2619,8 @@ class Tangent { /// /// The arguments must not be null. const Tangent(this.position, this.vector) - : assert(position != null), // ignore: unnecessary_null_comparison - assert(vector != null); // ignore: unnecessary_null_comparison + : assert(position != null), + assert(vector != null); /// Creates a [Tangent] based on the angle rather than the vector. /// @@ -2688,7 +2686,7 @@ class PathMetrics extends collection.IterableBase { /// Used by [PathMetrics] to track iteration from one segment of a path to the /// next for measurement. class PathMetricIterator implements Iterator { - PathMetricIterator._(this._pathMeasure) : assert(_pathMeasure != null); // ignore: unnecessary_null_comparison + PathMetricIterator._(this._pathMeasure) : assert(_pathMeasure != null); PathMetric? _pathMetric; _PathMeasure _pathMeasure; @@ -2732,7 +2730,7 @@ class PathMetricIterator implements Iterator { /// the path. class PathMetric { PathMetric._(this._measure) - : assert(_measure != null), // ignore: unnecessary_null_comparison + : assert(_measure != null), length = _measure.length(_measure.currentContourIndex), isClosed = _measure.isClosed(_measure.currentContourIndex), contourIndex = _measure.currentContourIndex; @@ -2902,8 +2900,8 @@ class MaskFilter { const MaskFilter.blur( this._style, this._sigma, - ) : assert(_style != null), // ignore: unnecessary_null_comparison - assert(_sigma != null); // ignore: unnecessary_null_comparison + ) : assert(_style != null), + assert(_sigma != null); final BlurStyle _style; final double _sigma; @@ -3123,27 +3121,27 @@ class ColorFilter implements ImageFilter { /// avoid repainting. class _ColorFilter extends NativeFieldWrapperClass2 { _ColorFilter.mode(this.creator) - : assert(creator != null), // ignore: unnecessary_null_comparison + : assert(creator != null), assert(creator._type == ColorFilter._kTypeMode) { _constructor(); _initMode(creator._color!.value, creator._blendMode!.index); } _ColorFilter.matrix(this.creator) - : assert(creator != null), // ignore: unnecessary_null_comparison + : assert(creator != null), assert(creator._type == ColorFilter._kTypeMatrix) { _constructor(); _initMatrix(Float32List.fromList(creator._matrix!)); } _ColorFilter.linearToSrgbGamma(this.creator) - : assert(creator != null), // ignore: unnecessary_null_comparison + : assert(creator != null), assert(creator._type == ColorFilter._kTypeLinearToSrgbGamma) { _constructor(); _initLinearToSrgbGamma(); } _ColorFilter.srgbToLinearGamma(this.creator) - : assert(creator != null), // ignore: unnecessary_null_comparison + : assert(creator != null), assert(creator._type == ColorFilter._kTypeSrgbToLinearGamma) { _constructor(); _initSrgbToLinearGamma(); @@ -3173,9 +3171,9 @@ class _ColorFilter extends NativeFieldWrapperClass2 { abstract class ImageFilter { /// Creates an image filter that applies a Gaussian blur. factory ImageFilter.blur({ double sigmaX = 0.0, double sigmaY = 0.0, TileMode tileMode = TileMode.clamp }) { - assert(sigmaX != null); // ignore: unnecessary_null_comparison - assert(sigmaY != null); // ignore: unnecessary_null_comparison - assert(tileMode != null); // ignore: unnecessary_null_comparison + assert(sigmaX != null); + assert(sigmaY != null); + assert(tileMode != null); return _GaussianBlurImageFilter(sigmaX: sigmaX, sigmaY: sigmaY, tileMode: tileMode); } @@ -3185,8 +3183,8 @@ abstract class ImageFilter { /// when used with [BackdropFilter] would magnify the background image. factory ImageFilter.matrix(Float64List matrix4, { FilterQuality filterQuality = FilterQuality.low }) { - assert(matrix4 != null); // ignore: unnecessary_null_comparison - assert(filterQuality != null); // ignore: unnecessary_null_comparison + assert(matrix4 != null); + assert(filterQuality != null); if (matrix4.length != 16) throw ArgumentError('"matrix4" must have 16 entries.'); return _MatrixImageFilter(data: Float64List.fromList(matrix4), filterQuality: filterQuality); @@ -3198,7 +3196,7 @@ abstract class ImageFilter { /// subsequently applying `inner` and `outer`, i.e., /// result = outer(inner(source)). factory ImageFilter.compose({ required ImageFilter outer, required ImageFilter inner }) { - assert (inner != null && outer != null); // ignore: unnecessary_null_comparison + assert (inner != null && outer != null); return _ComposeImageFilter(innerFilter: inner, outerFilter: outer); } @@ -3322,7 +3320,7 @@ class _ImageFilter extends NativeFieldWrapperClass2 { /// Creates an image filter that applies a Gaussian blur. _ImageFilter.blur(_GaussianBlurImageFilter filter) - : assert(filter != null), // ignore: unnecessary_null_comparison + : assert(filter != null), creator = filter { // ignore: prefer_initializing_formals _constructor(); _initBlur(filter.sigmaX, filter.sigmaY, filter.tileMode.index); @@ -3334,7 +3332,7 @@ class _ImageFilter extends NativeFieldWrapperClass2 { /// For example, applying a positive scale matrix (see [Matrix4.diagonal3]) /// when used with [BackdropFilter] would magnify the background image. _ImageFilter.matrix(_MatrixImageFilter filter) - : assert(filter != null), // ignore: unnecessary_null_comparison + : assert(filter != null), creator = filter { // ignore: prefer_initializing_formals if (filter.data.length != 16) throw ArgumentError('"matrix4" must have 16 entries.'); @@ -3345,7 +3343,7 @@ class _ImageFilter extends NativeFieldWrapperClass2 { /// Converts a color filter to an image filter. _ImageFilter.fromColorFilter(ColorFilter filter) - : assert(filter != null), // ignore: unnecessary_null_comparison + : assert(filter != null), creator = filter { // ignore: prefer_initializing_formals _constructor(); final _ColorFilter? nativeFilter = filter._toNativeColorFilter(); @@ -3355,7 +3353,7 @@ class _ImageFilter extends NativeFieldWrapperClass2 { /// Composes `_innerFilter` with `_outerFilter`. _ImageFilter.composed(_ComposeImageFilter filter) - : assert(filter != null), // ignore: unnecessary_null_comparison + : assert(filter != null), creator = filter { // ignore: prefer_initializing_formals _constructor(); final _ImageFilter nativeFilterInner = filter.innerFilter._toNativeImageFilter(); @@ -3469,7 +3467,7 @@ Int32List _encodeColorList(List colors) { } Float32List _encodePointList(List points) { - assert(points != null); // ignore: unnecessary_null_comparison + assert(points != null); final int pointCount = points.length; final Float32List result = Float32List(pointCount * 2); for (int i = 0; i < pointCount; ++i) { @@ -3537,9 +3535,9 @@ class Gradient extends Shader { Float64List? matrix4, ]) : assert(_offsetIsValid(from)), assert(_offsetIsValid(to)), - assert(colors != null), // ignore: unnecessary_null_comparison - assert(tileMode != null), // ignore: unnecessary_null_comparison - assert(matrix4 == null || _matrix4IsValid(matrix4)), // ignore: unnecessary_null_comparison + assert(colors != null), + assert(tileMode != null), + assert(matrix4 == null || _matrix4IsValid(matrix4)), super._() { _validateColorStops(colors, colorStops); final Float32List endPointsBuffer = _encodeTwoPoints(from, to); @@ -3589,8 +3587,8 @@ class Gradient extends Shader { Offset? focal, double focalRadius = 0.0 ]) : assert(_offsetIsValid(center)), - assert(colors != null), // ignore: unnecessary_null_comparison - assert(tileMode != null), // ignore: unnecessary_null_comparison + assert(colors != null), + assert(tileMode != null), assert(matrix4 == null || _matrix4IsValid(matrix4)), super._() { _validateColorStops(colors, colorStops); @@ -3646,10 +3644,10 @@ class Gradient extends Shader { double endAngle = math.pi * 2, Float64List? matrix4, ]) : assert(_offsetIsValid(center)), - assert(colors != null), // ignore: unnecessary_null_comparison - assert(tileMode != null), // ignore: unnecessary_null_comparison - assert(startAngle != null), // ignore: unnecessary_null_comparison - assert(endAngle != null), // ignore: unnecessary_null_comparison + assert(colors != null), + assert(tileMode != null), + assert(startAngle != null), + assert(endAngle != null), assert(startAngle < endAngle), assert(matrix4 == null || _matrix4IsValid(matrix4)), super._() { @@ -3681,11 +3679,10 @@ class ImageShader extends Shader { /// be null. @pragma('vm:entry-point') ImageShader(Image image, TileMode tmx, TileMode tmy, Float64List matrix4) : - // ignore: unnecessary_null_comparison assert(image != null), // image is checked on the engine side - assert(tmx != null), // ignore: unnecessary_null_comparison - assert(tmy != null), // ignore: unnecessary_null_comparison - assert(matrix4 != null), // ignore: unnecessary_null_comparison + assert(tmx != null), + assert(tmy != null), + assert(matrix4 != null), super._() { if (matrix4.length != 16) throw ArgumentError('"matrix4" must have 16 entries.'); @@ -3728,8 +3725,8 @@ class Vertices extends NativeFieldWrapperClass2 { List? textureCoordinates, List? colors, List? indices, - }) : assert(mode != null), // ignore: unnecessary_null_comparison - assert(positions != null) { // ignore: unnecessary_null_comparison + }) : assert(mode != null), + assert(positions != null) { if (textureCoordinates != null && textureCoordinates.length != positions.length) throw ArgumentError('"positions" and "textureCoordinates" lengths must match.'); if (colors != null && colors.length != positions.length) @@ -3776,8 +3773,8 @@ class Vertices extends NativeFieldWrapperClass2 { Float32List? textureCoordinates, Int32List? colors, Uint16List? indices, - }) : assert(mode != null), // ignore: unnecessary_null_comparison - assert(positions != null) { // ignore: unnecessary_null_comparison + }) : assert(mode != null), + assert(positions != null) { if (textureCoordinates != null && textureCoordinates.length != positions.length) throw ArgumentError('"positions" and "textureCoordinates" lengths must match.'); if (colors != null && colors.length * 2 != positions.length) @@ -3799,7 +3796,6 @@ class Vertices extends NativeFieldWrapperClass2 { /// Defines how a list of points is interpreted when drawing a set of points. /// -// ignore: deprecated_member_use /// Used by [Canvas.drawPoints]. // These enum values must be kept in sync with SkCanvas::PointMode. enum PointMode { @@ -3872,7 +3868,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// To end the recording, call [PictureRecorder.endRecording] on the /// given recorder. @pragma('vm:entry-point') - Canvas(PictureRecorder recorder, [ Rect? cullRect ]) : assert(recorder != null) { // ignore: unnecessary_null_comparison + Canvas(PictureRecorder recorder, [ Rect? cullRect ]) : assert(recorder != null) { if (recorder.isRecording) throw ArgumentError('"recorder" must not already be associated with another Canvas.'); _recorder = recorder; @@ -4011,7 +4007,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// * [BlendMode], which discusses the use of [Paint.blendMode] with /// [saveLayer]. void saveLayer(Rect? bounds, Paint paint) { - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); if (bounds == null) { _saveLayerWithoutBounds(paint._objects, paint._data); } else { @@ -4072,7 +4068,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Multiply the current transform by the specified 4⨉4 transformation matrix /// specified as a list of values in column-major order. void transform(Float64List matrix4) { - assert(matrix4 != null); // ignore: unnecessary_null_comparison + assert(matrix4 != null); if (matrix4.length != 16) throw ArgumentError('"matrix4" must have 16 entries.'); _transform(matrix4); @@ -4092,8 +4088,8 @@ class Canvas extends NativeFieldWrapperClass2 { /// current clip. void clipRect(Rect rect, { ClipOp clipOp = ClipOp.intersect, bool doAntiAlias = true }) { assert(_rectIsValid(rect)); - assert(clipOp != null); // ignore: unnecessary_null_comparison - assert(doAntiAlias != null); // ignore: unnecessary_null_comparison + assert(clipOp != null); + assert(doAntiAlias != null); _clipRect(rect.left, rect.top, rect.right, rect.bottom, clipOp.index, doAntiAlias); } void _clipRect(double left, @@ -4113,7 +4109,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// discussion of how to address that and some examples of using [clipRRect]. void clipRRect(RRect rrect, {bool doAntiAlias = true}) { assert(_rrectIsValid(rrect)); - assert(doAntiAlias != null); // ignore: unnecessary_null_comparison + assert(doAntiAlias != null); _clipRRect(rrect._value32, doAntiAlias); } void _clipRRect(Float32List rrect, bool doAntiAlias) native 'Canvas_clipRRect'; @@ -4128,9 +4124,8 @@ class Canvas extends NativeFieldWrapperClass2 { /// in incorrect blending at the clip boundary. See [saveLayer] for a /// discussion of how to address that. void clipPath(Path path, {bool doAntiAlias = true}) { - // ignore: unnecessary_null_comparison assert(path != null); // path is checked on the engine side - assert(doAntiAlias != null); // ignore: unnecessary_null_comparison + assert(doAntiAlias != null); _clipPath(path, doAntiAlias); } void _clipPath(Path path, bool doAntiAlias) native 'Canvas_clipPath'; @@ -4139,8 +4134,8 @@ class Canvas extends NativeFieldWrapperClass2 { /// [BlendMode], with the given color being the source and the background /// being the destination. void drawColor(Color color, BlendMode blendMode) { - assert(color != null); // ignore: unnecessary_null_comparison - assert(blendMode != null); // ignore: unnecessary_null_comparison + assert(color != null); + assert(blendMode != null); _drawColor(color.value, blendMode.index); } void _drawColor(int color, int blendMode) native 'Canvas_drawColor'; @@ -4152,7 +4147,7 @@ class Canvas extends NativeFieldWrapperClass2 { void drawLine(Offset p1, Offset p2, Paint paint) { assert(_offsetIsValid(p1)); assert(_offsetIsValid(p2)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawLine(p1.dx, p1.dy, p2.dx, p2.dy, paint._objects, paint._data); } void _drawLine(double x1, @@ -4167,7 +4162,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// To fill the canvas with a solid color and blend mode, consider /// [drawColor] instead. void drawPaint(Paint paint) { - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawPaint(paint._objects, paint._data); } void _drawPaint(List? paintObjects, ByteData paintData) native 'Canvas_drawPaint'; @@ -4176,7 +4171,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// or stroked (or both) is controlled by [Paint.style]. void drawRect(Rect rect, Paint paint) { assert(_rectIsValid(rect)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawRect(rect.left, rect.top, rect.right, rect.bottom, paint._objects, paint._data); } @@ -4191,7 +4186,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// filled or stroked (or both) is controlled by [Paint.style]. void drawRRect(RRect rrect, Paint paint) { assert(_rrectIsValid(rrect)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawRRect(rrect._value32, paint._objects, paint._data); } void _drawRRect(Float32List rrect, @@ -4206,7 +4201,7 @@ class Canvas extends NativeFieldWrapperClass2 { void drawDRRect(RRect outer, RRect inner, Paint paint) { assert(_rrectIsValid(outer)); assert(_rrectIsValid(inner)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawDRRect(outer._value32, inner._value32, paint._objects, paint._data); } void _drawDRRect(Float32List outer, @@ -4219,7 +4214,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// controlled by [Paint.style]. void drawOval(Rect rect, Paint paint) { assert(_rectIsValid(rect)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawOval(rect.left, rect.top, rect.right, rect.bottom, paint._objects, paint._data); } @@ -4236,7 +4231,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// controlled by [Paint.style]. void drawCircle(Offset c, double radius, Paint paint) { assert(_offsetIsValid(c)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawCircle(c.dx, c.dy, radius, paint._objects, paint._data); } void _drawCircle(double x, @@ -4258,7 +4253,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// This method is optimized for drawing arcs and should be faster than [Path.arcTo]. void drawArc(Rect rect, double startAngle, double sweepAngle, bool useCenter, Paint paint) { assert(_rectIsValid(rect)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawArc(rect.left, rect.top, rect.right, rect.bottom, startAngle, sweepAngle, useCenter, paint._objects, paint._data); } @@ -4278,9 +4273,8 @@ class Canvas extends NativeFieldWrapperClass2 { /// [Paint.style]. If the path is filled, then sub-paths within it are /// implicitly closed (see [Path.close]). void drawPath(Path path, Paint paint) { - // ignore: unnecessary_null_comparison assert(path != null); // path is checked on the engine side - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawPath(path, paint._objects, paint._data); } void _drawPath(Path path, @@ -4290,10 +4284,9 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draws the given [Image] into the canvas with its top-left corner at the /// given [Offset]. The image is composited into the canvas using the given [Paint]. void drawImage(Image image, Offset offset, Paint paint) { - // ignore: unnecessary_null_comparison assert(image != null); // image is checked on the engine side assert(_offsetIsValid(offset)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawImage(image._image, offset.dx, offset.dy, paint._objects, paint._data); } void _drawImage(_Image image, @@ -4312,11 +4305,10 @@ class Canvas extends NativeFieldWrapperClass2 { /// image) can be batched into a single call to [drawAtlas] to improve /// performance. void drawImageRect(Image image, Rect src, Rect dst, Paint paint) { - // ignore: unnecessary_null_comparison assert(image != null); // image is checked on the engine side assert(_rectIsValid(src)); assert(_rectIsValid(dst)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawImageRect(image._image, src.left, src.top, @@ -4355,11 +4347,10 @@ class Canvas extends NativeFieldWrapperClass2 { /// cover the destination rectangle while maintaining their relative /// positions. void drawImageNine(Image image, Rect center, Rect dst, Paint paint) { - // ignore: unnecessary_null_comparison assert(image != null); // image is checked on the engine side assert(_rectIsValid(center)); assert(_rectIsValid(dst)); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); _drawImageNine(image._image, center.left, center.top, @@ -4387,7 +4378,6 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draw the given picture onto the canvas. To create a picture, see /// [PictureRecorder]. void drawPicture(Picture picture) { - // ignore: unnecessary_null_comparison assert(picture != null); // picture is checked on the engine side _drawPicture(picture); } @@ -4414,7 +4404,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// described by adding half of the [ParagraphConstraints.width] given to /// [Paragraph.layout], to the `offset` argument's [Offset.dx] coordinate. void drawParagraph(Paragraph paragraph, Offset offset) { - assert(paragraph != null); // ignore: unnecessary_null_comparison + assert(paragraph != null); assert(_offsetIsValid(offset)); paragraph._paint(this, offset.dx, offset.dy); } @@ -4428,9 +4418,9 @@ class Canvas extends NativeFieldWrapperClass2 { /// * [drawRawPoints], which takes `points` as a [Float32List] rather than a /// [List]. void drawPoints(PointMode pointMode, List points, Paint paint) { - assert(pointMode != null); // ignore: unnecessary_null_comparison - assert(points != null); // ignore: unnecessary_null_comparison - assert(paint != null); // ignore: unnecessary_null_comparison + assert(pointMode != null); + assert(points != null); + assert(paint != null); _drawPoints(paint._objects, paint._data, pointMode.index, _encodePointList(points)); } @@ -4444,9 +4434,9 @@ class Canvas extends NativeFieldWrapperClass2 { /// * [drawPoints], which takes `points` as a [List] rather than a /// [List]. void drawRawPoints(PointMode pointMode, Float32List points, Paint paint) { - assert(pointMode != null); // ignore: unnecessary_null_comparison - assert(points != null); // ignore: unnecessary_null_comparison - assert(paint != null); // ignore: unnecessary_null_comparison + assert(pointMode != null); + assert(points != null); + assert(paint != null); if (points.length % 2 != 0) throw ArgumentError('"points" must have an even number of values.'); _drawPoints(paint._objects, paint._data, pointMode.index, points); @@ -4466,10 +4456,10 @@ class Canvas extends NativeFieldWrapperClass2 { /// * [Vertices.raw], which creates the vertices using typed data lists /// rather than unencoded lists. void drawVertices(Vertices vertices, BlendMode blendMode, Paint paint) { - // ignore: unnecessary_null_comparison + assert(vertices != null); // vertices is checked on the engine side - assert(paint != null); // ignore: unnecessary_null_comparison - assert(blendMode != null); // ignore: unnecessary_null_comparison + assert(paint != null); + assert(blendMode != null); _drawVertices(vertices, blendMode.index, paint._objects, paint._data); } void _drawVertices(Vertices vertices, @@ -4611,12 +4601,11 @@ class Canvas extends NativeFieldWrapperClass2 { BlendMode? blendMode, Rect? cullRect, Paint paint) { - // ignore: unnecessary_null_comparison assert(atlas != null); // atlas is checked on the engine side - assert(transforms != null); // ignore: unnecessary_null_comparison - assert(rects != null); // ignore: unnecessary_null_comparison + assert(transforms != null); + assert(rects != null); assert(colors == null || colors.isEmpty || blendMode != null); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); final int rectCount = rects.length; if (transforms.length != rectCount) @@ -4802,12 +4791,11 @@ class Canvas extends NativeFieldWrapperClass2 { BlendMode? blendMode, Rect? cullRect, Paint paint) { - // ignore: unnecessary_null_comparison assert(atlas != null); // atlas is checked on the engine side - assert(rstTransforms != null); // ignore: unnecessary_null_comparison - assert(rects != null); // ignore: unnecessary_null_comparison + assert(rstTransforms != null); + assert(rects != null); assert(colors == null || blendMode != null); - assert(paint != null); // ignore: unnecessary_null_comparison + assert(paint != null); final int rectCount = rects.length; if (rstTransforms.length != rectCount) @@ -4839,10 +4827,9 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// The arguments must not be null. void drawShadow(Path path, Color color, double elevation, bool transparentOccluder) { - // ignore: unnecessary_null_comparison assert(path != null); // path is checked on the engine side - assert(color != null); // ignore: unnecessary_null_comparison - assert(transparentOccluder != null); // ignore: unnecessary_null_comparison + assert(color != null); + assert(transparentOccluder != null); _drawShadow(path, color.value, elevation, transparentOccluder); } void _drawShadow(Path path, @@ -4961,8 +4948,8 @@ class Shadow { this.color = const Color(_kColorDefault), this.offset = Offset.zero, this.blurRadius = 0.0, - }) : assert(color != null, 'Text shadow color was null.'), // ignore: unnecessary_null_comparison - assert(offset != null, 'Text shadow offset was null.'), // ignore: unnecessary_null_comparison + }) : assert(color != null, 'Text shadow color was null.'), + assert(offset != null, 'Text shadow offset was null.'), assert(blurRadius >= 0.0, 'Text shadow blur radius should be non-negative.'); static const int _kColorDefault = 0xFF000000; @@ -5050,7 +5037,7 @@ class Shadow { /// an [AnimationController]. /// {@endtemplate} static Shadow? lerp(Shadow? a, Shadow? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (b == null) { if (a == null) { return null; @@ -5076,7 +5063,7 @@ class Shadow { /// /// {@macro dart.ui.shadow.lerp} static List? lerpList(List? a, List? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (a == null && b == null) return null; a ??= []; @@ -5121,7 +5108,6 @@ class Shadow { // TODO(yjbanov): remove the null check when the framework is migrated. While the list // of shadows contains non-nullable elements, unmigrated code can still // pass nulls. - // ignore: unnecessary_null_comparison if (shadow != null) { shadowOffset = shadowIndex * _kBytesPerShadow; diff --git a/lib/ui/platform_dispatcher.dart b/lib/ui/platform_dispatcher.dart index 01bcaabd15714..3efa757e6dae2 100644 --- a/lib/ui/platform_dispatcher.dart +++ b/lib/ui/platform_dispatcher.dart @@ -673,7 +673,7 @@ class PlatformDispatcher { /// observe when this callback is invoked. VoidCallback? get onLocaleChanged => _onLocaleChanged; VoidCallback? _onLocaleChanged; - Zone _onLocaleChangedZone = Zone.root; // ignore: unused_field + Zone _onLocaleChangedZone = Zone.root; set onLocaleChanged(VoidCallback? callback) { _onLocaleChanged = callback; _onLocaleChangedZone = Zone.current; @@ -1367,7 +1367,7 @@ class Locale { const Locale( this._languageCode, [ this._countryCode, - ]) : assert(_languageCode != null), // ignore: unnecessary_null_comparison + ]) : assert(_languageCode != null), assert(_languageCode != ''), scriptCode = null; @@ -1395,7 +1395,7 @@ class Locale { String languageCode = 'und', this.scriptCode, String? countryCode, - }) : assert(languageCode != null), // ignore: unnecessary_null_comparison + }) : assert(languageCode != null), assert(languageCode != ''), _languageCode = languageCode, assert(scriptCode != ''), diff --git a/lib/ui/plugins.dart b/lib/ui/plugins.dart index 4e9cb7e1442d7..e21e1bdcb8c20 100644 --- a/lib/ui/plugins.dart +++ b/lib/ui/plugins.dart @@ -15,7 +15,7 @@ class CallbackHandle { /// Only values produced by a call to [CallbackHandle.toRawHandle] should be /// used, otherwise this object will be an invalid handle. CallbackHandle.fromRawHandle(this._handle) - : assert(_handle != null, "'_handle' must not be null."); // ignore: unnecessary_null_comparison + : assert(_handle != null, "'_handle' must not be null."); final int _handle; @@ -61,7 +61,7 @@ class PluginUtilities { /// original callback. If `callback` is not a top-level or static function, /// null is returned. static CallbackHandle? getCallbackHandle(Function callback) { - assert(callback != null, "'callback' must not be null."); // ignore: unnecessary_null_comparison + assert(callback != null, "'callback' must not be null."); return _forwardCache.putIfAbsent(callback, () { final int? handle = _getCallbackHandle(callback); return handle != null ? CallbackHandle.fromRawHandle(handle) : null; @@ -77,7 +77,7 @@ class PluginUtilities { /// [PluginUtilities.getCallbackHandle], null is returned. Otherwise, a /// tear-off of the callback associated with `handle` is returned. static Function? getCallbackFromHandle(CallbackHandle handle) { - assert(handle != null, "'handle' must not be null."); // ignore: unnecessary_null_comparison + assert(handle != null, "'handle' must not be null."); return _backwardCache.putIfAbsent( handle, () => _getCallbackFromHandle(handle.toRawHandle())); } diff --git a/lib/ui/pointer.dart b/lib/ui/pointer.dart index 1da22c0b6c3b4..1b2bafbd11e7e 100644 --- a/lib/ui/pointer.dart +++ b/lib/ui/pointer.dart @@ -306,7 +306,7 @@ class PointerData { /// A sequence of reports about the state of pointers. class PointerDataPacket { /// Creates a packet of pointer data reports. - const PointerDataPacket({ this.data = const [] }) : assert(data != null); // ignore: unnecessary_null_comparison + const PointerDataPacket({ this.data = const [] }) : assert(data != null); /// Data about the individual pointers in this packet. /// diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index b62f2cf212e61..bb78c5ae7f30c 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -15,7 +15,7 @@ part of dart.ui; /// See also: /// - file://./../../lib/ui/semantics/semantics_node.h class SemanticsAction { - const SemanticsAction._(this.index) : assert(index != null); // ignore: unnecessary_null_comparison + const SemanticsAction._(this.index) : assert(index != null); static const int _kTapIndex = 1 << 0; static const int _kLongPressIndex = 1 << 1; @@ -319,7 +319,7 @@ class SemanticsFlag { // flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java, // and the SemanticsFlag class in lib/web_ui/lib/src/ui/semantics.dart. - const SemanticsFlag._(this.index) : assert(index != null); // ignore: unnecessary_null_comparison + const SemanticsFlag._(this.index) : assert(index != null); /// The numerical value for this flag. /// @@ -748,7 +748,6 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { }) { assert(_matrix4IsValid(transform)); assert( - // ignore: unnecessary_null_comparison scrollChildren == 0 || scrollChildren == null || (scrollChildren > 0 && childrenInHitTestOrder != null), 'If a node has scrollChildren, it must have childrenInHitTestOrder', ); @@ -832,8 +831,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// [SemanticsAction.index] value. For custom actions this argument should not be /// provided. void updateCustomAction({required int id, String? label, String? hint, int overrideId = -1}) { - assert(id != null); // ignore: unnecessary_null_comparison - assert(overrideId != null); // ignore: unnecessary_null_comparison + assert(id != null); + assert(overrideId != null); _updateCustomAction(id, label, hint, overrideId); } void _updateCustomAction( diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 10fb03c90a68c..ed03948dc3e86 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -81,7 +81,7 @@ class FontWeight { /// Values for `t` are usually obtained from an [Animation], such as /// an [AnimationController]. static FontWeight? lerp(FontWeight? a, FontWeight? b, double t) { - assert(t != null); // ignore: unnecessary_null_comparison + assert(t != null); if (a == null && b == null) return null; return values[_lerpInt((a ?? normal).index, (b ?? normal).index, t).round().clamp(0, 8)]; @@ -202,9 +202,9 @@ class FontFeature { const FontFeature( this.feature, [ this.value = 1 ] - ) : assert(feature != null), // ignore: unnecessary_null_comparison + ) : assert(feature != null), assert(feature.length == 4, 'Feature tag must be exactly four characters long.'), - assert(value != null), // ignore: unnecessary_null_comparison + assert(value != null), assert(value >= 0, 'Feature value must be zero or a positive integer.'); /// Create a [FontFeature] object that enables the feature with the given tag. @@ -2658,8 +2658,8 @@ class TextPosition { const TextPosition({ required this.offset, this.affinity = TextAffinity.downstream, - }) : assert(offset != null), // ignore: unnecessary_null_comparison - assert(affinity != null); // ignore: unnecessary_null_comparison + }) : assert(offset != null), + assert(affinity != null); /// The index of the character that immediately follows the position in the /// string representation of the text. @@ -2711,14 +2711,14 @@ class TextRange { const TextRange({ required this.start, required this.end, - }) : assert(start != null && start >= -1), // ignore: unnecessary_null_comparison - assert(end != null && end >= -1); // ignore: unnecessary_null_comparison + }) : assert(start != null && start >= -1), + assert(end != null && end >= -1); /// A text range that starts and ends at offset. /// /// The [offset] argument must be non-null and greater than or equal to -1. const TextRange.collapsed(int offset) - : assert(offset != null && offset >= -1), // ignore: unnecessary_null_comparison + : assert(offset != null && offset >= -1), start = offset, end = offset; @@ -2793,7 +2793,7 @@ class ParagraphConstraints { /// The [width] argument must not be null. const ParagraphConstraints({ required this.width, - }) : assert(width != null); // ignore: unnecessary_null_comparison + }) : assert(width != null); /// The width the paragraph should use whey computing the positions of glyphs. /// @@ -3173,8 +3173,8 @@ class Paragraph extends NativeFieldWrapperClass2 { /// /// See [BoxHeightStyle] and [BoxWidthStyle] for full descriptions of each option. List getBoxesForRange(int start, int end, {BoxHeightStyle boxHeightStyle = BoxHeightStyle.tight, BoxWidthStyle boxWidthStyle = BoxWidthStyle.tight}) { - assert(boxHeightStyle != null); // ignore: unnecessary_null_comparison - assert(boxWidthStyle != null); // ignore: unnecessary_null_comparison + assert(boxHeightStyle != null); + assert(boxWidthStyle != null); return _decodeTextBoxes(_getBoxesForRange(start, end, boxHeightStyle.index, boxWidthStyle.index)); } // See paragraph.cc for the layout of this return value. diff --git a/shell/platform/embedder/fixtures/main.dart b/shell/platform/embedder/fixtures/main.dart index 070179b9b9a15..f80f5dcf03945 100644 --- a/shell/platform/embedder/fixtures/main.dart +++ b/shell/platform/embedder/fixtures/main.dart @@ -93,7 +93,7 @@ Future get semanticsAction { } @pragma('vm:entry-point') -void a11y_main() async { // ignore: non_constant_identifier_names +void a11y_main() async { // Return initial state (semantics disabled). notifySemanticsEnabled(PlatformDispatcher.instance.semanticsEnabled); @@ -521,7 +521,7 @@ int _serializeKeyEventType(KeyEventType change) { // Echo the event data with `_echoKeyEvent`, and returns synthesized as handled. @pragma('vm:entry-point') -void key_data_echo() async { // ignore: non_constant_identifier_names +void key_data_echo() async { PlatformDispatcher.instance.onKeyData = (KeyData data) { _echoKeyEvent( _serializeKeyEventType(data.type), 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 da74c9bf658e7..7aa072ac1289e 100644 --- a/shell/platform/fuchsia/dart-pkg/zircon/lib/src/handle.dart +++ b/shell/platform/fuchsia/dart-pkg/zircon/lib/src/handle.dart @@ -45,7 +45,7 @@ class Handle extends NativeFieldWrapperClass2 { } @pragma('vm:entry-point') -class _OnWaitCompleteClosure { // ignore: unused_element +class _OnWaitCompleteClosure { // No public constructor - this can only be created from native code. @pragma('vm:entry-point') _OnWaitCompleteClosure(this._callback, this._arg1, this._arg2); @@ -55,5 +55,5 @@ class _OnWaitCompleteClosure { // ignore: unused_element Object _arg2; @pragma('vm:entry-point') - Function get _closure => () => _callback(_arg1, _arg2); // ignore: unused_element + Function get _closure => () => _callback(_arg1, _arg2); } diff --git a/shell/platform/fuchsia/dart-pkg/zircon/lib/src/system.dart b/shell/platform/fuchsia/dart-pkg/zircon/lib/src/system.dart index 725a07129b59d..2037fede99b72 100644 --- a/shell/platform/fuchsia/dart-pkg/zircon/lib/src/system.dart +++ b/shell/platform/fuchsia/dart-pkg/zircon/lib/src/system.dart @@ -8,14 +8,14 @@ part of zircon; // ignore_for_file: public_member_api_docs @pragma('vm:entry-point') -class _Namespace { // ignore: unused_element +class _Namespace { // No public constructor - this only has static methods. _Namespace._(); // Library private variable set by the embedder used to cache the // namespace (as an fdio_ns_t*). @pragma('vm:entry-point') - static int? _namespace; // ignore: unused_field + static int? _namespace; } /// An exception representing an error returned as an zx_status_t. diff --git a/testing/dart/window_hooks_integration_test.dart b/testing/dart/window_hooks_integration_test.dart index 3a1aac710f9f9..bb0030eee98fd 100644 --- a/testing/dart/window_hooks_integration_test.dart +++ b/testing/dart/window_hooks_integration_test.dart @@ -13,7 +13,7 @@ import 'dart:collection' as collection; import 'dart:convert'; import 'dart:developer' as developer; import 'dart:math' as math; -import 'dart:nativewrappers'; // ignore: unused_import +import 'dart:nativewrappers'; import 'dart:typed_data'; diff --git a/tools/const_finder/test/const_finder_test.dart b/tools/const_finder/test/const_finder_test.dart index 872ca3c177941..0a33e14069c24 100644 --- a/tools/const_finder/test/const_finder_test.dart +++ b/tools/const_finder/test/const_finder_test.dart @@ -140,22 +140,22 @@ void _checkNonConsts() { }, { 'file': 'file://$fixtures/lib/consts_and_non.dart', - 'line': 17, + 'line': 16, 'column': 26, }, { 'file': 'file://$fixtures/lib/consts_and_non.dart', - 'line': 17, + 'line': 16, 'column': 41, }, { 'file': 'file://$fixtures/lib/consts_and_non.dart', - 'line': 19, + 'line': 17, 'column': 26, }, { 'file': 'file://$fixtures/pkg/package.dart', - 'line': 14, + 'line': 13, 'column': 25, } ] diff --git a/tools/const_finder/test/fixtures/lib/consts.dart b/tools/const_finder/test/fixtures/lib/consts.dart index ba2c8de10137c..f7f29e61edd6e 100644 --- a/tools/const_finder/test/fixtures/lib/consts.dart +++ b/tools/const_finder/test/fixtures/lib/consts.dart @@ -11,7 +11,6 @@ import 'target.dart'; void main() { const Target target1 = Target('1', 1, null); const Target target2 = Target('2', 2, Target('4', 4, null)); - // ignore: unused_local_variable const Target target3 = Target('3', 3, Target('5', 5, null)); // should be tree shaken out. target1.hit(); target2.hit(); @@ -19,9 +18,7 @@ void main() { blah(const Target('6', 6, null)); const IgnoreMe ignoreMe = IgnoreMe(Target('7', 7, null)); // IgnoreMe is ignored but 7 is not. - // ignore: prefer_const_constructors final IgnoreMe ignoreMe2 = IgnoreMe(const Target('8', 8, null)); - // ignore: prefer_const_constructors final IgnoreMe ignoreMe3 = IgnoreMe(const Target('9', 9, Target('10', 10, null))); print(ignoreMe); print(ignoreMe2); diff --git a/tools/const_finder/test/fixtures/lib/consts_and_non.dart b/tools/const_finder/test/fixtures/lib/consts_and_non.dart index 86529fa9be7c4..3c5ebc7dac12d 100644 --- a/tools/const_finder/test/fixtures/lib/consts_and_non.dart +++ b/tools/const_finder/test/fixtures/lib/consts_and_non.dart @@ -13,9 +13,7 @@ void main() { const Target target1 = Target('1', 1, null); final Target target2 = Target('2', 2, const Target('4', 4, null)); - // ignore: unused_local_variable final Target target3 = Target('3', 3, Target('5', 5, null)); // should be tree shaken out. - // ignore: unused_local_variable final Target target6 = Target('6', 6, null); // should be tree shaken out. target1.hit(); target2.hit(); @@ -23,9 +21,7 @@ void main() { blah(const Target('6', 6, null)); const IgnoreMe ignoreMe = IgnoreMe(Target('7', 7, null)); // IgnoreMe is ignored but 7 is not. - // ignore: prefer_const_constructors final IgnoreMe ignoreMe2 = IgnoreMe(const Target('8', 8, null)); - // ignore: prefer_const_constructors final IgnoreMe ignoreMe3 = IgnoreMe(const Target('9', 9, Target('10', 10, null))); print(ignoreMe); print(ignoreMe2); diff --git a/tools/const_finder/test/fixtures/pkg/package.dart b/tools/const_finder/test/fixtures/pkg/package.dart index 1b9d1eb255a3a..7bd0ed473c333 100644 --- a/tools/const_finder/test/fixtures/pkg/package.dart +++ b/tools/const_finder/test/fixtures/pkg/package.dart @@ -10,7 +10,6 @@ void createTargetInPackage() { } void createNonConstTargetInPackage() { - // ignore: prefer_const_constructors final Target target = Target('package_non', -2, null); target.hit(); } diff --git a/tools/generate_package_config/bin/generate_from_legacy.dart b/tools/generate_package_config/bin/generate_from_legacy.dart index ae71032224dd9..f7aa918712ed9 100644 --- a/tools/generate_package_config/bin/generate_from_legacy.dart +++ b/tools/generate_package_config/bin/generate_from_legacy.dart @@ -7,7 +7,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:package_config/package_config.dart'; -import 'package:package_config/packages_file.dart'; // ignore: deprecated_member_use +import 'package:package_config/packages_file.dart'; import 'package:package_config/src/package_config_json.dart'; import 'package:pub_semver/pub_semver.dart'; import 'package:yaml/yaml.dart'; diff --git a/tools/licenses/lib/licenses.dart b/tools/licenses/lib/licenses.dart index 5e47ebbb11fed..d8ee7017e0095 100644 --- a/tools/licenses/lib/licenses.dart +++ b/tools/licenses/lib/licenses.dart @@ -585,7 +585,7 @@ _SplitLicense _splitLicense(String body, { bool verifyResults = true }) { if (!lines.moveNext()) throw 'tried to split empty license'; int end = 0; - while (true) { // ignore: literal_only_boolean_expressions + while (true) { final String line = lines.current.value; if (line == 'Author:' || line == 'This code is derived from software contributed to Berkeley by' || diff --git a/web_sdk/web_engine_tester/lib/golden_tester.dart b/web_sdk/web_engine_tester/lib/golden_tester.dart index 630607931c779..787a4dbb25d4e 100644 --- a/web_sdk/web_engine_tester/lib/golden_tester.dart +++ b/web_sdk/web_engine_tester/lib/golden_tester.dart @@ -8,7 +8,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:html' as html; -// ignore: implementation_imports import 'package:ui/src/engine.dart'; import 'package:ui/ui.dart';