Unverified Commit 9837eb6f authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove unnecessary null checks in flutter/rendering (#118923)

parent bae4c1d2
......@@ -82,11 +82,7 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
super.textDirection,
super.child,
Clip clipBehavior = Clip.hardEdge,
}) : assert(vsync != null),
assert(duration != null),
assert(curve != null),
assert(clipBehavior != null),
_vsync = vsync,
}) : _vsync = vsync,
_clipBehavior = clipBehavior {
_controller = AnimationController(
vsync: vsync,
......@@ -119,7 +115,6 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
/// The duration of the animation.
Duration get duration => _controller.duration!;
set duration(Duration value) {
assert(value != null);
if (value == _controller.duration) {
return;
}
......@@ -138,7 +133,6 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
/// The curve of the animation.
Curve get curve => _animation.curve;
set curve(Curve value) {
assert(value != null);
if (value == _animation.curve) {
return;
}
......@@ -151,7 +145,6 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......@@ -169,7 +162,6 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
TickerProvider get vsync => _vsync;
TickerProvider _vsync;
set vsync(TickerProvider value) {
assert(value != null);
if (value == _vsync) {
return;
}
......@@ -218,7 +210,6 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
child!.layout(constraints, parentUsesSize: true);
assert(_state != null);
switch (_state) {
case RenderAnimatedSizeState.start:
_layoutStart();
......@@ -253,7 +244,6 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
// size without modifying global state. See performLayout for comments
// explaining the rational behind the implementation.
final Size childSize = child!.getDryLayout(constraints);
assert(_state != null);
switch (_state) {
case RenderAnimatedSizeState.start:
return constraints.constrain(childSize);
......
......@@ -43,7 +43,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
..onSemanticsAction = _handleSemanticsAction;
initRenderView();
_handleSemanticsEnabledChanged();
assert(renderView != null);
addPersistentFrameCallback(_handlePersistentFrameCallback);
initMouseTracker();
if (kIsWeb) {
......@@ -234,7 +233,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
/// Sets the given [RenderView] object (which must not be null), and its tree, to
/// be the new render tree to display. The previous tree, if any, is detached.
set renderView(RenderView value) {
assert(value != null);
_pipelineOwner.rootNode = value;
}
......@@ -244,7 +242,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
@protected
@visibleForTesting
void handleMetricsChanged() {
assert(renderView != null);
renderView.configuration = createViewConfiguration();
if (renderView.child != null) {
scheduleForcedFrame();
......@@ -512,7 +509,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
// When editing the above, also update widgets/binding.dart's copy.
@protected
void drawFrame() {
assert(renderView != null);
pipelineOwner.flushLayout();
pipelineOwner.flushCompositingBits();
pipelineOwner.flushPaint();
......@@ -544,9 +540,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
@override
void hitTest(HitTestResult result, Offset position) {
assert(renderView != null);
assert(result != null);
assert(position != null);
renderView.hitTest(result, position: position);
super.hitTest(result, position);
}
......@@ -620,7 +613,6 @@ class RenderingFlutterBinding extends BindingBase with GestureBinding, Scheduler
/// This binding does not automatically schedule any frames. Callers are
/// responsible for deciding when to first call [scheduleFrame].
RenderingFlutterBinding({ RenderBox? root }) {
assert(renderView != null);
renderView.child = root;
}
......
......@@ -96,10 +96,7 @@ class BoxConstraints extends Constraints {
this.maxWidth = double.infinity,
this.minHeight = 0.0,
this.maxHeight = double.infinity,
}) : assert(minWidth != null),
assert(maxWidth != null),
assert(minHeight != null),
assert(maxHeight != null);
});
/// Creates box constraints that is respected only by the given size.
BoxConstraints.tight(Size size)
......@@ -190,7 +187,6 @@ class BoxConstraints extends Constraints {
/// Returns new box constraints that are smaller by the given edge dimensions.
BoxConstraints deflate(EdgeInsets edges) {
assert(edges != null);
assert(debugAssertIsValid());
final double horizontal = edges.horizontal;
final double vertical = edges.vertical;
......@@ -472,7 +468,6 @@ class BoxConstraints extends Constraints {
///
/// {@macro dart.ui.shadow.lerp}
static BoxConstraints? lerp(BoxConstraints? a, BoxConstraints? b, double t) {
assert(t != null);
if (a == null && b == null) {
return null;
}
......@@ -762,8 +757,6 @@ class BoxHitTestResult extends HitTestResult {
required Offset position,
required BoxHitTest hitTest,
}) {
assert(position != null);
assert(hitTest != null);
if (transform != null) {
transform = Matrix4.tryInvert(PointerEvent.removePerspectiveTransform(transform));
if (transform == null) {
......@@ -801,8 +794,6 @@ class BoxHitTestResult extends HitTestResult {
required Offset position,
required BoxHitTest hitTest,
}) {
assert(position != null);
assert(hitTest != null);
final Offset transformedPosition = offset == null ? position : position - offset;
if (offset != null) {
pushOffset(-offset);
......@@ -838,9 +829,6 @@ class BoxHitTestResult extends HitTestResult {
required Offset position,
required BoxHitTest hitTest,
}) {
assert(position != null);
assert(hitTest != null);
assert(position != null);
final Offset transformedPosition = transform == null ?
position : MatrixUtils.transformPoint(transform, position);
if (transform != null) {
......@@ -887,7 +875,6 @@ class BoxHitTestResult extends HitTestResult {
Matrix4? rawTransform,
required BoxHitTestWithOutOfBandPosition hitTest,
}) {
assert(hitTest != null);
assert(
(paintOffset == null && paintTransform == null && rawTransform != null) ||
(paintOffset == null && paintTransform != null && rawTransform == null) ||
......@@ -915,8 +902,7 @@ class BoxHitTestEntry extends HitTestEntry<RenderBox> {
/// Creates a box hit test entry.
///
/// The [localPosition] argument must not be null.
BoxHitTestEntry(super.target, this.localPosition)
: assert(localPosition != null);
BoxHitTestEntry(super.target, this.localPosition);
/// The position of the hit test in the local coordinates of [target].
final Offset localPosition;
......@@ -1452,13 +1438,6 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper
double getMinIntrinsicWidth(double height) {
assert(() {
if (height == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The height argument to getMinIntrinsicWidth was null.'),
ErrorDescription('The argument to getMinIntrinsicWidth must not be negative or null.'),
ErrorHint('If you do not have a specific height in mind, then pass double.infinity instead.'),
]);
}
if (height < 0.0) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The height argument to getMinIntrinsicWidth was negative.'),
......@@ -1601,13 +1580,6 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper
double getMaxIntrinsicWidth(double height) {
assert(() {
if (height == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The height argument to getMaxIntrinsicWidth was null.'),
ErrorDescription('The argument to getMaxIntrinsicWidth must not be negative or null.'),
ErrorHint('If you do not have a specific height in mind, then pass double.infinity instead.'),
]);
}
if (height < 0.0) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The height argument to getMaxIntrinsicWidth was negative.'),
......@@ -1684,13 +1656,6 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper
double getMinIntrinsicHeight(double width) {
assert(() {
if (width == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The width argument to getMinIntrinsicHeight was null.'),
ErrorDescription('The argument to getMinIntrinsicHeight must not be negative or null.'),
ErrorHint('If you do not have a specific width in mind, then pass double.infinity instead.'),
]);
}
if (width < 0.0) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The width argument to getMinIntrinsicHeight was negative.'),
......@@ -1766,13 +1731,6 @@ abstract class RenderBox extends RenderObject {
@mustCallSuper
double getMaxIntrinsicHeight(double width) {
assert(() {
if (width == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The width argument to getMaxIntrinsicHeight was null.'),
ErrorDescription('The argument to getMaxIntrinsicHeight must not be negative or null.'),
ErrorHint('If you do not have a specific width in mind, then pass double.infinity instead.'),
]);
}
if (width < 0.0) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The width argument to getMaxIntrinsicHeight was negative.'),
......@@ -2253,7 +2211,6 @@ abstract class RenderBox extends RenderObject {
@override
void debugAssertDoesMeetConstraints() {
assert(constraints != null);
assert(() {
if (!hasSize) {
final DiagnosticsNode contract;
......@@ -2582,7 +2539,6 @@ abstract class RenderBox extends RenderObject {
/// child's [parentData] in the [BoxParentData.offset] field.
@override
void applyPaintTransform(RenderObject child, Matrix4 transform) {
assert(child != null);
assert(child.parent == this);
assert(() {
if (child.parentData is! BoxParentData) {
......
......@@ -187,11 +187,6 @@ abstract class MultiChildLayoutDelegate {
'There is no child with the id "$childId".',
);
}
if (offset == null) {
throw FlutterError(
'The $this custom multichild layout delegate provided a null position for the child with id "$childId".',
);
}
return true;
}());
final MultiChildLayoutParentData childParentData = child!.parentData! as MultiChildLayoutParentData;
......@@ -311,8 +306,7 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
RenderCustomMultiChildLayoutBox({
List<RenderBox>? children,
required MultiChildLayoutDelegate delegate,
}) : assert(delegate != null),
_delegate = delegate {
}) : _delegate = delegate {
addAll(children);
}
......@@ -327,7 +321,6 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
MultiChildLayoutDelegate get delegate => _delegate;
MultiChildLayoutDelegate _delegate;
set delegate(MultiChildLayoutDelegate newDelegate) {
assert(newDelegate != null);
if (_delegate == newDelegate) {
return;
}
......
......@@ -294,8 +294,7 @@ class CustomPainterSemantics {
required this.properties,
this.transform,
this.tags,
}) : assert(rect != null),
assert(properties != null);
});
/// Identifies this object in a list of siblings.
///
......@@ -371,8 +370,7 @@ class RenderCustomPaint extends RenderProxyBox {
this.isComplex = false,
this.willChange = false,
RenderBox? child,
}) : assert(preferredSize != null),
_painter = painter,
}) : _painter = painter,
_foregroundPainter = foregroundPainter,
_preferredSize = preferredSize,
super(child);
......@@ -467,7 +465,6 @@ class RenderCustomPaint extends RenderProxyBox {
Size get preferredSize => _preferredSize;
Size _preferredSize;
set preferredSize(Size value) {
assert(value != null);
if (preferredSize == value) {
return;
}
......
......@@ -199,7 +199,6 @@ enum CrossAxisAlignment {
}
bool? _startIsTopLeft(Axis direction, TextDirection? textDirection, VerticalDirection? verticalDirection) {
assert(direction != null);
// If the relevant value of textDirection or verticalDirection is null, this returns null too.
switch (direction) {
case Axis.horizontal:
......@@ -289,12 +288,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
VerticalDirection verticalDirection = VerticalDirection.down,
TextBaseline? textBaseline,
Clip clipBehavior = Clip.none,
}) : assert(direction != null),
assert(mainAxisAlignment != null),
assert(mainAxisSize != null),
assert(crossAxisAlignment != null),
assert(clipBehavior != null),
_direction = direction,
}) : _direction = direction,
_mainAxisAlignment = mainAxisAlignment,
_mainAxisSize = mainAxisSize,
_crossAxisAlignment = crossAxisAlignment,
......@@ -309,7 +303,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
Axis get direction => _direction;
Axis _direction;
set direction(Axis value) {
assert(value != null);
if (_direction != value) {
_direction = value;
markNeedsLayout();
......@@ -328,7 +321,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
MainAxisAlignment get mainAxisAlignment => _mainAxisAlignment;
MainAxisAlignment _mainAxisAlignment;
set mainAxisAlignment(MainAxisAlignment value) {
assert(value != null);
if (_mainAxisAlignment != value) {
_mainAxisAlignment = value;
markNeedsLayout();
......@@ -348,7 +340,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
MainAxisSize get mainAxisSize => _mainAxisSize;
MainAxisSize _mainAxisSize;
set mainAxisSize(MainAxisSize value) {
assert(value != null);
if (_mainAxisSize != value) {
_mainAxisSize = value;
markNeedsLayout();
......@@ -367,7 +358,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
CrossAxisAlignment get crossAxisAlignment => _crossAxisAlignment;
CrossAxisAlignment _crossAxisAlignment;
set crossAxisAlignment(CrossAxisAlignment value) {
assert(value != null);
if (_crossAxisAlignment != value) {
_crossAxisAlignment = value;
markNeedsLayout();
......@@ -444,8 +434,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
bool get _debugHasNecessaryDirections {
assert(direction != null);
assert(crossAxisAlignment != null);
if (firstChild != null && lastChild != firstChild) {
// i.e. there's more than one child
switch (direction) {
......@@ -453,7 +441,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
assert(textDirection != null, 'Horizontal $runtimeType with multiple children has a null textDirection, so the layout order is undefined.');
break;
case Axis.vertical:
assert(verticalDirection != null, 'Vertical $runtimeType with multiple children has a null verticalDirection, so the layout order is undefined.');
break;
}
}
......@@ -464,7 +451,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
assert(textDirection != null, 'Horizontal $runtimeType with $mainAxisAlignment has a null textDirection, so the alignment cannot be resolved.');
break;
case Axis.vertical:
assert(verticalDirection != null, 'Vertical $runtimeType with $mainAxisAlignment has a null verticalDirection, so the alignment cannot be resolved.');
break;
}
}
......@@ -472,7 +458,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
crossAxisAlignment == CrossAxisAlignment.end) {
switch (direction) {
case Axis.horizontal:
assert(verticalDirection != null, 'Horizontal $runtimeType with $crossAxisAlignment has a null verticalDirection, so the alignment cannot be resolved.');
break;
case Axis.vertical:
assert(textDirection != null, 'Vertical $runtimeType with $crossAxisAlignment has a null textDirection, so the alignment cannot be resolved.');
......@@ -494,7 +479,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......@@ -795,7 +779,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
_LayoutSizes _computeSizes({required BoxConstraints constraints, required ChildLayouter layoutChild}) {
assert(_debugHasNecessaryDirections);
assert(constraints != null);
// Determine used flex factor, size inflexible items, calculate free space.
int totalFlex = 0;
......@@ -861,7 +844,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
minChildExtent = 0.0;
break;
}
assert(minChildExtent != null);
final BoxConstraints innerConstraints;
if (crossAxisAlignment == CrossAxisAlignment.stretch) {
switch (_direction) {
......
......@@ -183,9 +183,7 @@ class RenderFlow extends RenderBox
List<RenderBox>? children,
required FlowDelegate delegate,
Clip clipBehavior = Clip.hardEdge,
}) : assert(delegate != null),
assert(clipBehavior != null),
_delegate = delegate,
}) : _delegate = delegate,
_clipBehavior = clipBehavior {
addAll(children);
}
......@@ -209,7 +207,6 @@ class RenderFlow extends RenderBox
/// to determine whether the new delegate requires this object to update its
/// layout or painting.
set delegate(FlowDelegate newDelegate) {
assert(newDelegate != null);
if (_delegate == newDelegate) {
return;
}
......@@ -234,7 +231,6 @@ class RenderFlow extends RenderBox
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......
......@@ -44,13 +44,7 @@ class RenderImage extends RenderBox {
bool invertColors = false,
bool isAntiAlias = false,
FilterQuality filterQuality = FilterQuality.low,
}) : assert(scale != null),
assert(repeat != null),
assert(alignment != null),
assert(filterQuality != null),
assert(matchTextDirection != null),
assert(isAntiAlias != null),
_image = image,
}) : _image = image,
_width = width,
_height = height,
_scale = scale,
......@@ -144,7 +138,6 @@ class RenderImage extends RenderBox {
double get scale => _scale;
double _scale;
set scale(double value) {
assert(value != null);
if (value == _scale) {
return;
}
......@@ -200,7 +193,6 @@ class RenderImage extends RenderBox {
FilterQuality get filterQuality => _filterQuality;
FilterQuality _filterQuality;
set filterQuality(FilterQuality value) {
assert(value != null);
if (value == _filterQuality) {
return;
}
......@@ -249,7 +241,6 @@ class RenderImage extends RenderBox {
AlignmentGeometry get alignment => _alignment;
AlignmentGeometry _alignment;
set alignment(AlignmentGeometry value) {
assert(value != null);
if (value == _alignment) {
return;
}
......@@ -261,7 +252,6 @@ class RenderImage extends RenderBox {
ImageRepeat get repeat => _repeat;
ImageRepeat _repeat;
set repeat(ImageRepeat value) {
assert(value != null);
if (value == _repeat) {
return;
}
......@@ -318,7 +308,6 @@ class RenderImage extends RenderBox {
bool get matchTextDirection => _matchTextDirection;
bool _matchTextDirection;
set matchTextDirection(bool value) {
assert(value != null);
if (value == _matchTextDirection) {
return;
}
......@@ -350,7 +339,6 @@ class RenderImage extends RenderBox {
if (_isAntiAlias == value) {
return;
}
assert(value != null);
_isAntiAlias = value;
markNeedsPaint();
}
......
......@@ -24,7 +24,7 @@ class AnnotationEntry<T> {
const AnnotationEntry({
required this.annotation,
required this.localPosition,
}) : assert(localPosition != null);
});
/// The annotation object that is found.
final T annotation;
......@@ -891,8 +891,7 @@ class TextureLayer extends Layer {
required this.textureId,
this.freeze = false,
this.filterQuality = ui.FilterQuality.low,
}) : assert(rect != null),
assert(textureId != null);
});
/// Bounding rectangle of this layer.
final Rect rect;
......@@ -939,8 +938,7 @@ class PlatformViewLayer extends Layer {
PlatformViewLayer({
required this.rect,
required this.viewId,
}) : assert(rect != null),
assert(viewId != null);
});
/// Bounding rectangle of this layer in the global coordinate space.
final Rect rect;
......@@ -1027,7 +1025,6 @@ class PerformanceOverlayLayer extends Layer {
@override
void addToScene(ui.SceneBuilder builder) {
assert(optionsMask != null);
builder.addPerformanceOverlay(optionsMask, overlayRect);
builder.setRasterizerTracingThreshold(rasterizerThreshold);
builder.setCheckerboardRasterCacheImages(checkerboardRasterCacheImages);
......@@ -1255,7 +1252,6 @@ class ContainerLayer extends Layer {
child._nextSibling = null;
assert(child.attached == attached);
dropChild(child);
assert(child._parentHandle != null);
child._parentHandle.layer = null;
child = next;
}
......@@ -1318,7 +1314,6 @@ class ContainerLayer extends Layer {
/// position.
void applyTransform(Layer? child, Matrix4 transform) {
assert(child != null);
assert(transform != null);
}
/// Returns the descendants of this layer in depth first order.
......@@ -1399,7 +1394,6 @@ class OffsetLayer extends ContainerLayer {
@override
void applyTransform(Layer? child, Matrix4 transform) {
assert(child != null);
assert(transform != null);
transform.translate(offset.dx, offset.dy);
}
......@@ -1426,8 +1420,6 @@ class OffsetLayer extends ContainerLayer {
}
ui.Scene _createSceneForImage(Rect bounds, { double pixelRatio = 1.0 }) {
assert(bounds != null);
assert(pixelRatio != null);
final ui.SceneBuilder builder = ui.SceneBuilder();
final Matrix4 transform = Matrix4.diagonal3Values(pixelRatio, pixelRatio, 1);
transform.translate(-(bounds.left + offset.dx), -(bounds.top + offset.dy));
......@@ -1521,7 +1513,6 @@ class ClipRectLayer extends ContainerLayer {
Clip clipBehavior = Clip.hardEdge,
}) : _clipRect = clipRect,
_clipBehavior = clipBehavior,
assert(clipBehavior != null),
assert(clipBehavior != Clip.none);
/// The rectangle to clip in the parent's coordinate system.
......@@ -1550,7 +1541,6 @@ class ClipRectLayer extends ContainerLayer {
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior;
set clipBehavior(Clip value) {
assert(value != null);
assert(value != Clip.none);
if (value != _clipBehavior) {
_clipBehavior = value;
......@@ -1569,7 +1559,6 @@ class ClipRectLayer extends ContainerLayer {
@override
void addToScene(ui.SceneBuilder builder) {
assert(clipRect != null);
assert(clipBehavior != null);
bool enabled = true;
assert(() {
enabled = !debugDisableClipLayers;
......@@ -1613,7 +1602,6 @@ class ClipRRectLayer extends ContainerLayer {
Clip clipBehavior = Clip.antiAlias,
}) : _clipRRect = clipRRect,
_clipBehavior = clipBehavior,
assert(clipBehavior != null),
assert(clipBehavior != Clip.none);
/// The rounded-rect to clip in the parent's coordinate system.
......@@ -1638,7 +1626,6 @@ class ClipRRectLayer extends ContainerLayer {
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior;
set clipBehavior(Clip value) {
assert(value != null);
assert(value != Clip.none);
if (value != _clipBehavior) {
_clipBehavior = value;
......@@ -1657,7 +1644,6 @@ class ClipRRectLayer extends ContainerLayer {
@override
void addToScene(ui.SceneBuilder builder) {
assert(clipRRect != null);
assert(clipBehavior != null);
bool enabled = true;
assert(() {
enabled = !debugDisableClipLayers;
......@@ -1701,7 +1687,6 @@ class ClipPathLayer extends ContainerLayer {
Clip clipBehavior = Clip.antiAlias,
}) : _clipPath = clipPath,
_clipBehavior = clipBehavior,
assert(clipBehavior != null),
assert(clipBehavior != Clip.none);
/// The path to clip in the parent's coordinate system.
......@@ -1726,7 +1711,6 @@ class ClipPathLayer extends ContainerLayer {
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior;
set clipBehavior(Clip value) {
assert(value != null);
assert(value != Clip.none);
if (value != _clipBehavior) {
_clipBehavior = value;
......@@ -1745,7 +1729,6 @@ class ClipPathLayer extends ContainerLayer {
@override
void addToScene(ui.SceneBuilder builder) {
assert(clipPath != null);
assert(clipBehavior != null);
bool enabled = true;
assert(() {
enabled = !debugDisableClipLayers;
......@@ -1940,7 +1923,6 @@ class TransformLayer extends OffsetLayer {
@override
void applyTransform(Layer? child, Matrix4 transform) {
assert(child != null);
assert(transform != null);
assert(_lastEffectiveTransform != null || this.transform != null);
if (_lastEffectiveTransform == null) {
transform.multiply(this.transform!);
......@@ -2250,7 +2232,6 @@ class PhysicalModelLayer extends ContainerLayer {
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsAddToScene();
......@@ -2310,7 +2291,6 @@ class PhysicalModelLayer extends ContainerLayer {
@override
void addToScene(ui.SceneBuilder builder) {
assert(clipPath != null);
assert(clipBehavior != null);
assert(elevation != null);
assert(color != null);
assert(shadowColor != null);
......@@ -2437,7 +2417,7 @@ class LeaderLayer extends ContainerLayer {
///
/// The [offset] property must be non-null before the compositing phase of the
/// pipeline.
LeaderLayer({ required LayerLink link, Offset offset = Offset.zero }) : assert(link != null), _link = link, _offset = offset;
LeaderLayer({ required LayerLink link, Offset offset = Offset.zero }) : _link = link, _offset = offset;
/// The object with which this layer should register.
///
......@@ -2446,7 +2426,6 @@ class LeaderLayer extends ContainerLayer {
LayerLink get link => _link;
LayerLink _link;
set link(LayerLink value) {
assert(value != null);
if (_link == value) {
return;
}
......@@ -2467,7 +2446,6 @@ class LeaderLayer extends ContainerLayer {
Offset get offset => _offset;
Offset _offset;
set offset(Offset value) {
assert(value != null);
if (value == _offset) {
return;
}
......@@ -2496,7 +2474,6 @@ class LeaderLayer extends ContainerLayer {
@override
void addToScene(ui.SceneBuilder builder) {
assert(offset != null);
if (offset != Offset.zero) {
engineLayer = builder.pushTransform(
Matrix4.translationValues(offset.dx, offset.dy, 0.0).storage,
......@@ -2551,23 +2528,18 @@ class FollowerLayer extends ContainerLayer {
/// The [unlinkedOffset], [linkedOffset], and [showWhenUnlinked] properties
/// must be non-null before the compositing phase of the pipeline.
FollowerLayer({
required LayerLink link,
required this.link,
this.showWhenUnlinked = true,
this.unlinkedOffset = Offset.zero,
this.linkedOffset = Offset.zero,
}) : assert(link != null), _link = link;
});
/// The link to the [LeaderLayer].
///
/// The same object should be provided to a [LeaderLayer] that is earlier in
/// the layer tree. When this layer is composited, it will apply a transform
/// that moves its children to match the position of the [LeaderLayer].
LayerLink get link => _link;
set link(LayerLink value) {
assert(value != null);
_link = value;
}
LayerLink _link;
LayerLink link;
/// Whether to show the layer's contents when the [link] does not point to a
/// [LeaderLayer].
......@@ -2631,7 +2603,7 @@ class FollowerLayer extends ContainerLayer {
@override
bool findAnnotations<S extends Object>(AnnotationResult<S> result, Offset localPosition, { required bool onlyFirst }) {
if (_link.leader == null) {
if (link.leader == null) {
if (showWhenUnlinked!) {
return super.findAnnotations(result, localPosition - unlinkedOffset!, onlyFirst: onlyFirst);
}
......@@ -2740,9 +2712,8 @@ class FollowerLayer extends ContainerLayer {
/// Populate [_lastTransform] given the current state of the tree.
void _establishTransform() {
assert(link != null);
_lastTransform = null;
final LeaderLayer? leader = _link.leader;
final LeaderLayer? leader = link.leader;
// Check to see if we are linked.
if (leader == null) {
return;
......@@ -2806,9 +2777,8 @@ class FollowerLayer extends ContainerLayer {
@override
void addToScene(ui.SceneBuilder builder) {
assert(link != null);
assert(showWhenUnlinked != null);
if (_link.leader == null && !showWhenUnlinked!) {
if (link.leader == null && !showWhenUnlinked!) {
_lastTransform = null;
_lastOffset = null;
_inverseDirty = true;
......@@ -2840,7 +2810,6 @@ class FollowerLayer extends ContainerLayer {
@override
void applyTransform(Layer? child, Matrix4 transform) {
assert(child != null);
assert(transform != null);
if (_lastTransform != null) {
transform.multiply(_lastTransform!);
} else {
......@@ -2886,9 +2855,7 @@ class AnnotatedRegionLayer<T extends Object> extends ContainerLayer {
this.size,
Offset? offset,
this.opaque = false,
}) : assert(value != null),
assert(opaque != null),
offset = offset ?? Offset.zero;
}) : offset = offset ?? Offset.zero;
/// The annotated object, which is added to the result if all restrictions are
/// met.
......
......@@ -32,8 +32,7 @@ class RenderListBody extends RenderBox
RenderListBody({
List<RenderBox>? children,
AxisDirection axisDirection = AxisDirection.down,
}) : assert(axisDirection != null),
_axisDirection = axisDirection {
}) : _axisDirection = axisDirection {
addAll(children);
}
......@@ -51,7 +50,6 @@ class RenderListBody extends RenderBox
AxisDirection get axisDirection => _axisDirection;
AxisDirection _axisDirection;
set axisDirection(AxisDirection value) {
assert(value != null);
if (_axisDirection == value) {
return;
}
......@@ -259,7 +257,6 @@ class RenderListBody extends RenderBox
@override
double computeMinIntrinsicWidth(double height) {
assert(mainAxis != null);
switch (mainAxis) {
case Axis.horizontal:
return _getIntrinsicMainAxis((RenderBox child) => child.getMinIntrinsicWidth(height));
......@@ -270,7 +267,6 @@ class RenderListBody extends RenderBox
@override
double computeMaxIntrinsicWidth(double height) {
assert(mainAxis != null);
switch (mainAxis) {
case Axis.horizontal:
return _getIntrinsicMainAxis((RenderBox child) => child.getMaxIntrinsicWidth(height));
......@@ -281,7 +277,6 @@ class RenderListBody extends RenderBox
@override
double computeMinIntrinsicHeight(double width) {
assert(mainAxis != null);
switch (mainAxis) {
case Axis.horizontal:
return _getIntrinsicMainAxis((RenderBox child) => child.getMinIntrinsicHeight(width));
......@@ -292,7 +287,6 @@ class RenderListBody extends RenderBox
@override
double computeMaxIntrinsicHeight(double width) {
assert(mainAxis != null);
switch (mainAxis) {
case Axis.horizontal:
return _getIntrinsicMainAxis((RenderBox child) => child.getMaxIntrinsicHeight(width));
......
......@@ -149,25 +149,13 @@ class RenderListWheelViewport
bool renderChildrenOutsideViewport = false,
Clip clipBehavior = Clip.none,
List<RenderBox>? children,
}) : assert(childManager != null),
assert(offset != null),
assert(diameterRatio != null),
assert(diameterRatio > 0, diameterRatioZeroMessage),
assert(perspective != null),
}) : assert(diameterRatio > 0, diameterRatioZeroMessage),
assert(perspective > 0),
assert(perspective <= 0.01, perspectiveTooHighMessage),
assert(offAxisFraction != null),
assert(useMagnifier != null),
assert(magnification != null),
assert(magnification > 0),
assert(overAndUnderCenterOpacity != null),
assert(overAndUnderCenterOpacity >= 0 && overAndUnderCenterOpacity <= 1),
assert(itemExtent != null),
assert(squeeze != null),
assert(squeeze > 0),
assert(itemExtent > 0),
assert(renderChildrenOutsideViewport != null),
assert(clipBehavior != null),
assert(
!renderChildrenOutsideViewport || clipBehavior == Clip.none,
clipBehaviorAndRenderChildrenOutsideViewportConflict,
......@@ -225,7 +213,6 @@ class RenderListWheelViewport
ViewportOffset get offset => _offset;
ViewportOffset _offset;
set offset(ViewportOffset value) {
assert(value != null);
if (value == _offset) {
return;
}
......@@ -270,7 +257,6 @@ class RenderListWheelViewport
double get diameterRatio => _diameterRatio;
double _diameterRatio;
set diameterRatio(double value) {
assert(value != null);
assert(
value > 0,
diameterRatioZeroMessage,
......@@ -300,7 +286,6 @@ class RenderListWheelViewport
double get perspective => _perspective;
double _perspective;
set perspective(double value) {
assert(value != null);
assert(value > 0);
assert(
value <= 0.01,
......@@ -342,7 +327,6 @@ class RenderListWheelViewport
double get offAxisFraction => _offAxisFraction;
double _offAxisFraction = 0.0;
set offAxisFraction(double value) {
assert(value != null);
if (value == _offAxisFraction) {
return;
}
......@@ -356,7 +340,6 @@ class RenderListWheelViewport
bool get useMagnifier => _useMagnifier;
bool _useMagnifier = false;
set useMagnifier(bool value) {
assert(value != null);
if (value == _useMagnifier) {
return;
}
......@@ -376,7 +359,6 @@ class RenderListWheelViewport
double get magnification => _magnification;
double _magnification = 1.0;
set magnification(double value) {
assert(value != null);
assert(value > 0);
if (value == _magnification) {
return;
......@@ -396,7 +378,6 @@ class RenderListWheelViewport
double get overAndUnderCenterOpacity => _overAndUnderCenterOpacity;
double _overAndUnderCenterOpacity = 1.0;
set overAndUnderCenterOpacity(double value) {
assert(value != null);
assert(value >= 0 && value <= 1);
if (value == _overAndUnderCenterOpacity) {
return;
......@@ -414,7 +395,6 @@ class RenderListWheelViewport
double get itemExtent => _itemExtent;
double _itemExtent;
set itemExtent(double value) {
assert(value != null);
assert(value > 0);
if (value == _itemExtent) {
return;
......@@ -447,7 +427,6 @@ class RenderListWheelViewport
double get squeeze => _squeeze;
double _squeeze;
set squeeze(double value) {
assert(value != null);
assert(value > 0);
if (value == _squeeze) {
return;
......@@ -470,7 +449,6 @@ class RenderListWheelViewport
bool get renderChildrenOutsideViewport => _renderChildrenOutsideViewport;
bool _renderChildrenOutsideViewport;
set renderChildrenOutsideViewport(bool value) {
assert(value != null);
assert(
!renderChildrenOutsideViewport || clipBehavior == Clip.none,
clipBehaviorAndRenderChildrenOutsideViewportConflict,
......@@ -489,7 +467,6 @@ class RenderListWheelViewport
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......@@ -636,7 +613,6 @@ class RenderListWheelViewport
///
/// This relies on the [childManager] maintaining [ListWheelParentData.index].
int indexOf(RenderBox child) {
assert(child != null);
final ListWheelParentData childParentData = child.parentData! as ListWheelParentData;
assert(childParentData.index != null);
return childParentData.index!;
......
......@@ -30,8 +30,7 @@ typedef MouseDetectorAnnotationFinder = HitTestResult Function(Offset offset);
class _MouseState {
_MouseState({
required PointerEvent initialEvent,
}) : assert(initialEvent != null),
_latestEvent = initialEvent;
}) : _latestEvent = initialEvent;
// The list of annotations that contains this device.
//
......@@ -40,7 +39,6 @@ class _MouseState {
LinkedHashMap<MouseTrackerAnnotation, Matrix4> _annotations = LinkedHashMap<MouseTrackerAnnotation, Matrix4>();
LinkedHashMap<MouseTrackerAnnotation, Matrix4> replaceAnnotations(LinkedHashMap<MouseTrackerAnnotation, Matrix4> value) {
assert(value != null);
final LinkedHashMap<MouseTrackerAnnotation, Matrix4> previous = _annotations;
_annotations = value;
return previous;
......@@ -51,7 +49,6 @@ class _MouseState {
PointerEvent _latestEvent;
PointerEvent replaceLatestEvent(PointerEvent value) {
assert(value != null);
assert(value.device == _latestEvent.device);
final PointerEvent previous = _latestEvent;
_latestEvent = value;
......@@ -83,10 +80,7 @@ class _MouseTrackerUpdateDetails with Diagnosticable {
required this.lastAnnotations,
required this.nextAnnotations,
required PointerEvent this.previousEvent,
}) : assert(previousEvent != null),
assert(lastAnnotations != null),
assert(nextAnnotations != null),
triggeringEvent = null;
}) : triggeringEvent = null;
/// When device update is triggered by a pointer event.
///
......@@ -97,9 +91,7 @@ class _MouseTrackerUpdateDetails with Diagnosticable {
required this.nextAnnotations,
this.previousEvent,
required PointerEvent this.triggeringEvent,
}) : assert(triggeringEvent != null),
assert(lastAnnotations != null),
assert(nextAnnotations != null);
});
/// The annotations that the device is hovering before the update.
///
......@@ -129,7 +121,6 @@ class _MouseTrackerUpdateDetails with Diagnosticable {
/// The pointing device of this update.
int get device {
final int result = (previousEvent ?? triggeringEvent)!.device;
assert(result != null);
return result;
}
......@@ -138,7 +129,6 @@ class _MouseTrackerUpdateDetails with Diagnosticable {
/// The [latestEvent] is never null.
PointerEvent get latestEvent {
final PointerEvent result = triggeringEvent ?? previousEvent!;
assert(result != null);
return result;
}
......@@ -219,7 +209,6 @@ class MouseTracker extends ChangeNotifier {
if (state == null) {
return true;
}
assert(event != null);
final PointerEvent lastEvent = state.latestEvent;
assert(event.device == lastEvent.device);
// An Added can only follow a Removed, and a Removed can only be followed
......@@ -236,7 +225,6 @@ class MouseTracker extends ChangeNotifier {
}
LinkedHashMap<MouseTrackerAnnotation, Matrix4> _hitTestResultToAnnotations(HitTestResult result) {
assert(result != null);
final LinkedHashMap<MouseTrackerAnnotation, Matrix4> annotations = LinkedHashMap<MouseTrackerAnnotation, Matrix4>();
for (final HitTestEntry entry in result.path) {
final Object target = entry.target;
......@@ -253,8 +241,6 @@ class MouseTracker extends ChangeNotifier {
// If the device is not connected or not a mouse, an empty map is returned
// without calling `hitTest`.
LinkedHashMap<MouseTrackerAnnotation, Matrix4> _findAnnotations(_MouseState state, MouseDetectorAnnotationFinder hitTest) {
assert(state != null);
assert(hitTest != null);
final Offset globalPosition = state.latestEvent.position;
final int device = state.device;
if (!_mouseStates.containsKey(device)) {
......
......@@ -83,9 +83,7 @@ class PaintingContext extends ClipContext {
/// Typically only called by [PaintingContext.repaintCompositedChild]
/// and [pushLayer].
@protected
PaintingContext(this._containerLayer, this.estimatedBounds)
: assert(_containerLayer != null),
assert(estimatedBounds != null);
PaintingContext(this._containerLayer, this.estimatedBounds);
final ContainerLayer _containerLayer;
......@@ -462,7 +460,6 @@ class PaintingContext extends ClipContext {
/// * [addLayer], for pushing a layer without painting further contents
/// within it.
void pushLayer(ContainerLayer childLayer, PaintingContextCallback painter, Offset offset, { Rect? childPaintBounds }) {
assert(painter != null);
// If a layer is being reused, it may already contain children. We remove
// them so that `painter` can add children that are relevant for this frame.
if (childLayer.hasChildren) {
......@@ -560,7 +557,6 @@ class PaintingContext extends ClipContext {
///
/// {@macro flutter.rendering.PaintingContext.pushClipRect.oldLayer}
ClipRRectLayer? pushClipRRect(bool needsCompositing, Offset offset, Rect bounds, RRect clipRRect, PaintingContextCallback painter, { Clip clipBehavior = Clip.antiAlias, ClipRRectLayer? oldLayer }) {
assert(clipBehavior != null);
if (clipBehavior == Clip.none) {
painter(this, offset);
return null;
......@@ -600,7 +596,6 @@ class PaintingContext extends ClipContext {
///
/// {@macro flutter.rendering.PaintingContext.pushClipRect.oldLayer}
ClipPathLayer? pushClipPath(bool needsCompositing, Offset offset, Rect bounds, Path clipPath, PaintingContextCallback painter, { Clip clipBehavior = Clip.antiAlias, ClipPathLayer? oldLayer }) {
assert(clipBehavior != null);
if (clipBehavior == Clip.none) {
painter(this, offset);
return null;
......@@ -637,7 +632,6 @@ class PaintingContext extends ClipContext {
/// ancestor render objects that this render object will include a composited
/// layer, which, for example, causes them to use composited clips.
ColorFilterLayer pushColorFilter(Offset offset, ColorFilter colorFilter, PaintingContextCallback painter, { ColorFilterLayer? oldLayer }) {
assert(colorFilter != null);
final ColorFilterLayer layer = oldLayer ?? ColorFilterLayer();
layer.colorFilter = colorFilter;
pushLayer(layer, painter, offset);
......@@ -831,8 +825,7 @@ typedef LayoutCallback<T extends Constraints> = void Function(T constraints);
/// You can obtain the [PipelineOwner] using the [RenderObject.owner] property.
class SemanticsHandle {
SemanticsHandle._(PipelineOwner owner, this.listener)
: assert(owner != null),
_owner = owner {
: _owner = owner {
if (listener != null) {
_owner.semanticsOwner!.addListener(listener!);
}
......@@ -1510,7 +1503,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
@override
void adoptChild(RenderObject child) {
assert(_debugCanPerformMutations);
assert(child != null);
setupParentData(child);
markNeedsLayout();
markNeedsCompositingBitsUpdate();
......@@ -1525,7 +1517,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
@override
void dropChild(RenderObject child) {
assert(_debugCanPerformMutations);
assert(child != null);
assert(child.parentData != null);
child._cleanRelayoutBoundary();
child.parentData!.detach();
......@@ -2079,7 +2070,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
arguments: debugTimelineArguments,
);
}
assert(constraints != null);
assert(constraints.debugAssertIsValid(
isAppliedConstraint: true,
informationCollector: () {
......@@ -3249,7 +3239,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
_SemanticsFragment _getSemanticsForParent({
required bool mergeIntoParent,
}) {
assert(mergeIntoParent != null);
assert(!_needsLayout, 'Updated layout information required for $this to calculate semantics.');
final SemanticsConfiguration config = _semanticsConfiguration;
......@@ -3975,7 +3964,6 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
/// The previous child before the given child in the child list.
ChildType? childBefore(ChildType child) {
assert(child != null);
assert(child.parent == this);
final ParentDataType childParentData = child.parentData! as ParentDataType;
return childParentData.previousSibling;
......@@ -3983,7 +3971,6 @@ mixin ContainerRenderObjectMixin<ChildType extends RenderObject, ParentDataType
/// The next child after the given child in the child list.
ChildType? childAfter(ChildType child) {
assert(child != null);
assert(child.parent == this);
final ParentDataType childParentData = child.parentData! as ParentDataType;
return childParentData.nextSibling;
......@@ -4088,7 +4075,7 @@ mixin RelayoutWhenSystemFontsChangeMixin on RenderObject {
abstract class _SemanticsFragment {
_SemanticsFragment({
required this.dropsSemanticsOfPreviousSiblings,
}) : assert (dropsSemanticsOfPreviousSiblings != null);
});
/// Incorporate the fragments of children into this fragment.
void addAll(Iterable<_InterestingSemanticsFragment> fragments);
......@@ -4139,8 +4126,7 @@ abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
_InterestingSemanticsFragment({
required RenderObject owner,
required super.dropsSemanticsOfPreviousSiblings,
}) : assert(owner != null),
_ancestorChain = <RenderObject>[owner];
}) : _ancestorChain = <RenderObject>[owner];
/// The [RenderObject] that owns this fragment (and any new [SemanticsNode]
/// introduced by it).
......@@ -4322,9 +4308,7 @@ class _SwitchableSemanticsFragment extends _InterestingSemanticsFragment {
required super.dropsSemanticsOfPreviousSiblings,
}) : _siblingMergeGroups = siblingMergeGroups,
_mergeIntoParent = mergeIntoParent,
_config = config,
assert(mergeIntoParent != null),
assert(config != null);
_config = config;
final bool _mergeIntoParent;
SemanticsConfiguration _config;
......@@ -4679,7 +4663,6 @@ class _SemanticsGeometry {
/// From parent to child coordinate system.
static Rect? _transformRect(Rect? rect, Matrix4 transform) {
assert(transform != null);
if (rect == null) {
return null;
}
......@@ -4700,18 +4683,12 @@ class _SemanticsGeometry {
Matrix4 transform,
Matrix4 clipRectTransform,
) {
assert(ancestor != null);
assert(child != null);
assert(transform != null);
assert(clipRectTransform != null);
assert(clipRectTransform.isIdentity());
RenderObject intermediateParent = child.parent! as RenderObject;
assert(intermediateParent != null);
while (intermediateParent != ancestor) {
intermediateParent.applyPaintTransform(child, transform);
intermediateParent = intermediateParent.parent! as RenderObject;
child = child.parent! as RenderObject;
assert(intermediateParent != null);
}
ancestor.applyPaintTransform(child, transform);
ancestor.applyPaintTransform(child, clipRectTransform);
......@@ -4757,8 +4734,7 @@ class DiagnosticsDebugCreator extends DiagnosticsProperty<Object> {
/// Create a [DiagnosticsProperty] with its [value] initialized to input
/// [RenderObject.debugCreator].
DiagnosticsDebugCreator(Object value)
: assert(value != null),
super(
: super(
'debugCreator',
value,
level: DiagnosticLevel.hidden,
......
......@@ -88,15 +88,8 @@ class RenderParagraph extends RenderBox
List<RenderBox>? children,
Color? selectionColor,
SelectionRegistrar? registrar,
}) : assert(text != null),
assert(text.debugAssertIsValid()),
assert(textAlign != null),
assert(textDirection != null),
assert(softWrap != null),
assert(overflow != null),
assert(textScaleFactor != null),
}) : assert(text.debugAssertIsValid()),
assert(maxLines == null || maxLines > 0),
assert(textWidthBasis != null),
_softWrap = softWrap,
_overflow = overflow,
_selectionColor = selectionColor,
......@@ -132,7 +125,6 @@ class RenderParagraph extends RenderBox
/// The text to display.
InlineSpan get text => _textPainter.text!;
set text(InlineSpan value) {
assert(value != null);
switch (_textPainter.text!.compareTo(value)) {
case RenderComparison.identical:
return;
......@@ -279,7 +271,6 @@ class RenderParagraph extends RenderBox
/// How the text should be aligned horizontally.
TextAlign get textAlign => _textPainter.textAlign;
set textAlign(TextAlign value) {
assert(value != null);
if (_textPainter.textAlign == value) {
return;
}
......@@ -302,7 +293,6 @@ class RenderParagraph extends RenderBox
/// This must not be null.
TextDirection get textDirection => _textPainter.textDirection!;
set textDirection(TextDirection value) {
assert(value != null);
if (_textPainter.textDirection == value) {
return;
}
......@@ -320,7 +310,6 @@ class RenderParagraph extends RenderBox
bool get softWrap => _softWrap;
bool _softWrap;
set softWrap(bool value) {
assert(value != null);
if (_softWrap == value) {
return;
}
......@@ -332,7 +321,6 @@ class RenderParagraph extends RenderBox
TextOverflow get overflow => _overflow;
TextOverflow _overflow;
set overflow(TextOverflow value) {
assert(value != null);
if (_overflow == value) {
return;
}
......@@ -347,7 +335,6 @@ class RenderParagraph extends RenderBox
/// the specified font size.
double get textScaleFactor => _textPainter.textScaleFactor;
set textScaleFactor(double value) {
assert(value != null);
if (_textPainter.textScaleFactor == value) {
return;
}
......@@ -405,7 +392,6 @@ class RenderParagraph extends RenderBox
/// {@macro flutter.painting.textPainter.textWidthBasis}
TextWidthBasis get textWidthBasis => _textPainter.textWidthBasis;
set textWidthBasis(TextWidthBasis value) {
assert(value != null);
if (_textPainter.textWidthBasis == value) {
return;
}
......@@ -490,7 +476,6 @@ class RenderParagraph extends RenderBox
@override
double computeDistanceToActualBaseline(TextBaseline baseline) {
assert(!debugNeedsLayout);
assert(constraints != null);
assert(constraints.debugAssertIsValid());
_layoutTextWithConstraints(constraints);
// TODO(garyq): Since our metric for ideographic baseline is currently
......@@ -813,7 +798,6 @@ class RenderParagraph extends RenderBox
_overflowShader = null;
break;
case TextOverflow.fade:
assert(textDirection != null);
_needsClipping = true;
final TextPainter fadeSizePainter = TextPainter(
text: TextSpan(style: _textPainter.text!.style, text: '\u2026'),
......@@ -975,8 +959,6 @@ class RenderParagraph extends RenderBox
ui.BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight,
}) {
assert(!debugNeedsLayout);
assert(boxHeightStyle != null);
assert(boxWidthStyle != null);
_layoutTextWithConstraints(constraints);
return _textPainter.getBoxesForSelection(
selection,
......
......@@ -67,11 +67,7 @@ class RenderPerformanceOverlay extends RenderBox {
int rasterizerThreshold = 0,
bool checkerboardRasterCacheImages = false,
bool checkerboardOffscreenLayers = false,
}) : assert(optionsMask != null),
assert(rasterizerThreshold != null),
assert(checkerboardRasterCacheImages != null),
assert(checkerboardOffscreenLayers != null),
_optionsMask = optionsMask,
}) : _optionsMask = optionsMask,
_rasterizerThreshold = rasterizerThreshold,
_checkerboardRasterCacheImages = checkerboardRasterCacheImages,
_checkerboardOffscreenLayers = checkerboardOffscreenLayers;
......@@ -81,7 +77,6 @@ class RenderPerformanceOverlay extends RenderBox {
int get optionsMask => _optionsMask;
int _optionsMask;
set optionsMask(int value) {
assert(value != null);
if (value == _optionsMask) {
return;
}
......@@ -95,7 +90,6 @@ class RenderPerformanceOverlay extends RenderBox {
int get rasterizerThreshold => _rasterizerThreshold;
int _rasterizerThreshold;
set rasterizerThreshold(int value) {
assert(value != null);
if (value == _rasterizerThreshold) {
return;
}
......@@ -107,7 +101,6 @@ class RenderPerformanceOverlay extends RenderBox {
bool get checkerboardRasterCacheImages => _checkerboardRasterCacheImages;
bool _checkerboardRasterCacheImages;
set checkerboardRasterCacheImages(bool value) {
assert(value != null);
if (value == _checkerboardRasterCacheImages) {
return;
}
......@@ -119,7 +112,6 @@ class RenderPerformanceOverlay extends RenderBox {
bool get checkerboardOffscreenLayers => _checkerboardOffscreenLayers;
bool _checkerboardOffscreenLayers;
set checkerboardOffscreenLayers(bool value) {
assert(value != null);
if (value == _checkerboardOffscreenLayers) {
return;
}
......
......@@ -80,11 +80,7 @@ class RenderAndroidView extends PlatformViewRenderBox {
required PlatformViewHitTestBehavior hitTestBehavior,
required Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers,
Clip clipBehavior = Clip.hardEdge,
}) : assert(viewController != null),
assert(hitTestBehavior != null),
assert(gestureRecognizers != null),
assert(clipBehavior != null),
_viewController = viewController,
}) : _viewController = viewController,
_clipBehavior = clipBehavior,
super(controller: viewController, hitTestBehavior: hitTestBehavior, gestureRecognizers: gestureRecognizers) {
_viewController.pointTransformer = (Offset offset) => globalToLocal(offset);
......@@ -110,8 +106,6 @@ class RenderAndroidView extends PlatformViewRenderBox {
@override
set controller(AndroidViewController controller) {
assert(!_isDisposed);
assert(_viewController != null);
assert(controller != null);
if (_viewController == controller) {
return;
}
......@@ -132,7 +126,6 @@ class RenderAndroidView extends PlatformViewRenderBox {
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......@@ -299,10 +292,7 @@ class RenderUiKitView extends RenderBox {
required UiKitViewController viewController,
required this.hitTestBehavior,
required Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers,
}) : assert(viewController != null),
assert(hitTestBehavior != null),
assert(gestureRecognizers != null),
_viewController = viewController {
}) : _viewController = viewController {
updateGestureRecognizers(gestureRecognizers);
}
......@@ -314,7 +304,6 @@ class RenderUiKitView extends RenderBox {
UiKitViewController get viewController => _viewController;
UiKitViewController _viewController;
set viewController(UiKitViewController value) {
assert(value != null);
if (_viewController == value) {
return;
}
......@@ -333,7 +322,6 @@ class RenderUiKitView extends RenderBox {
/// {@macro flutter.rendering.PlatformViewRenderBox.updateGestureRecognizers}
void updateGestureRecognizers(Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers) {
assert(gestureRecognizers != null);
assert(
_factoriesTypeSet(gestureRecognizers).length == gestureRecognizers.length,
'There were multiple gesture recognizer factories for the same type, there must only be a single '
......@@ -632,9 +620,7 @@ class PlatformViewRenderBox extends RenderBox with _PlatformViewGestureMixin {
required PlatformViewController controller,
required PlatformViewHitTestBehavior hitTestBehavior,
required Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers,
}) : assert(controller != null && controller.viewId != null && controller.viewId > -1),
assert(hitTestBehavior != null),
assert(gestureRecognizers != null),
}) : assert(controller.viewId > -1),
_controller = controller {
this.hitTestBehavior = hitTestBehavior;
updateGestureRecognizers(gestureRecognizers);
......@@ -645,8 +631,7 @@ class PlatformViewRenderBox extends RenderBox with _PlatformViewGestureMixin {
PlatformViewController _controller;
/// This value must not be null, and setting it to a new value will result in a repaint.
set controller(covariant PlatformViewController controller) {
assert(controller != null);
assert(controller.viewId != null && controller.viewId > -1);
assert(controller.viewId > -1);
if (_controller == controller) {
return;
......@@ -695,7 +680,6 @@ class PlatformViewRenderBox extends RenderBox with _PlatformViewGestureMixin {
@override
void paint(PaintingContext context, Offset offset) {
assert(_controller.viewId != null);
context.addLayer(PlatformViewLayer(
rect: offset & size,
viewId: _controller.viewId,
......@@ -705,7 +689,6 @@ class PlatformViewRenderBox extends RenderBox with _PlatformViewGestureMixin {
@override
void describeSemanticsConfiguration(SemanticsConfiguration config) {
super.describeSemanticsConfiguration(config);
assert(_controller.viewId != null);
config.isSemanticBoundary = true;
config.platformViewId = _controller.viewId;
}
......@@ -733,7 +716,6 @@ mixin _PlatformViewGestureMixin on RenderBox implements MouseTrackerAnnotation {
/// Any active gesture arena the `PlatformView` participates in is rejected when the
/// set of gesture recognizers is changed.
void _updateGestureRecognizersWithCallBack(Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers, _HandlePointerEvent handlePointerEvent) {
assert(gestureRecognizers != null);
assert(
_factoriesTypeSet(gestureRecognizers).length == gestureRecognizers.length,
'There were multiple gesture recognizer factories for the same type, there must only be a single '
......
......@@ -74,14 +74,12 @@ abstract class RenderProxySliver extends RenderSliver with RenderObjectWithChild
@override
double childMainAxisPosition(RenderSliver child) {
assert(child != null);
assert(child == this.child);
return 0.0;
}
@override
void applyPaintTransform(RenderObject child, Matrix4 transform) {
assert(child != null);
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
childParentData.applyPaintTransform(transform);
}
......@@ -105,8 +103,7 @@ class RenderSliverOpacity extends RenderProxySliver {
double opacity = 1.0,
bool alwaysIncludeSemantics = false,
RenderSliver? sliver,
}) : assert(opacity != null && opacity >= 0.0 && opacity <= 1.0),
assert(alwaysIncludeSemantics != null),
}) : assert(opacity >= 0.0 && opacity <= 1.0),
_opacity = opacity,
_alwaysIncludeSemantics = alwaysIncludeSemantics,
_alpha = ui.Color.getAlphaFromOpacity(opacity) {
......@@ -131,7 +128,6 @@ class RenderSliverOpacity extends RenderProxySliver {
double get opacity => _opacity;
double _opacity;
set opacity(double value) {
assert(value != null);
assert(value >= 0.0 && value <= 1.0);
if (_opacity == value) {
return;
......@@ -220,8 +216,7 @@ class RenderSliverIgnorePointer extends RenderProxySliver {
RenderSliver? sliver,
bool ignoring = true,
bool? ignoringSemantics,
}) : assert(ignoring != null),
_ignoring = ignoring,
}) : _ignoring = ignoring,
_ignoringSemantics = ignoringSemantics {
child = sliver;
}
......@@ -233,7 +228,6 @@ class RenderSliverIgnorePointer extends RenderProxySliver {
bool get ignoring => _ignoring;
bool _ignoring;
set ignoring(bool value) {
assert(value != null);
if (value == _ignoring) {
return;
}
......@@ -297,8 +291,7 @@ class RenderSliverOffstage extends RenderProxySliver {
RenderSliverOffstage({
bool offstage = true,
RenderSliver? sliver,
}) : assert(offstage != null),
_offstage = offstage {
}) : _offstage = offstage {
child = sliver;
}
......@@ -313,7 +306,6 @@ class RenderSliverOffstage extends RenderProxySliver {
bool _offstage;
set offstage(bool value) {
assert(value != null);
if (value == _offstage) {
return;
}
......@@ -401,8 +393,7 @@ class RenderSliverAnimatedOpacity extends RenderProxySliver with RenderAnimatedO
required Animation<double> opacity,
bool alwaysIncludeSemantics = false,
RenderSliver? sliver,
}) : assert(opacity != null),
assert(alwaysIncludeSemantics != null) {
}) {
this.opacity = opacity;
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
child = sliver;
......
......@@ -24,8 +24,7 @@ class RenderRotatedBox extends RenderBox with RenderObjectWithChildMixin<RenderB
RenderRotatedBox({
required int quarterTurns,
RenderBox? child,
}) : assert(quarterTurns != null),
_quarterTurns = quarterTurns {
}) : _quarterTurns = quarterTurns {
this.child = child;
}
......@@ -33,7 +32,6 @@ class RenderRotatedBox extends RenderBox with RenderObjectWithChildMixin<RenderB
int get quarterTurns => _quarterTurns;
int _quarterTurns;
set quarterTurns(int value) {
assert(value != null);
if (_quarterTurns == value) {
return;
}
......
......@@ -687,9 +687,7 @@ class SelectionPoint {
required this.localPosition,
required this.lineHeight,
required this.handleType,
}) : assert(localPosition != null),
assert(lineHeight != null),
assert(handleType != null);
});
/// The position of the selection point in the local coordinates of the
/// containing [Selectable].
......
......@@ -107,8 +107,7 @@ class RenderPadding extends RenderShiftedBox {
required EdgeInsetsGeometry padding,
TextDirection? textDirection,
RenderBox? child,
}) : assert(padding != null),
assert(padding.isNonNegative),
}) : assert(padding.isNonNegative),
_textDirection = textDirection,
_padding = padding,
super(child);
......@@ -135,7 +134,6 @@ class RenderPadding extends RenderShiftedBox {
EdgeInsetsGeometry get padding => _padding;
EdgeInsetsGeometry _padding;
set padding(EdgeInsetsGeometry value) {
assert(value != null);
assert(value.isNonNegative);
if (_padding == value) {
return;
......@@ -277,8 +275,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
AlignmentGeometry alignment = Alignment.center,
required TextDirection? textDirection,
RenderBox? child,
}) : assert(alignment != null),
_alignment = alignment,
}) : _alignment = alignment,
_textDirection = textDirection,
super(child);
......@@ -314,7 +311,6 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
///
/// The new alignment must not be null.
set alignment(AlignmentGeometry value) {
assert(value != null);
if (_alignment == value) {
return;
}
......@@ -697,10 +693,7 @@ class RenderConstraintsTransformBox extends RenderAligningShiftedBox with DebugO
required BoxConstraintsTransform constraintsTransform,
super.child,
Clip clipBehavior = Clip.none,
}) : assert(alignment != null),
assert(clipBehavior != null),
assert(constraintsTransform != null),
_constraintsTransform = constraintsTransform,
}) : _constraintsTransform = constraintsTransform,
_clipBehavior = clipBehavior;
/// {@macro flutter.widgets.constraintsTransform}
......@@ -729,7 +722,6 @@ class RenderConstraintsTransformBox extends RenderAligningShiftedBox with DebugO
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......@@ -783,7 +775,6 @@ class RenderConstraintsTransformBox extends RenderAligningShiftedBox with DebugO
final RenderBox? child = this.child;
if (child != null) {
final BoxConstraints childConstraints = constraintsTransform(constraints);
assert(childConstraints != null);
assert(childConstraints.isNormalized, '$childConstraints is not normalized');
_childConstraints = childConstraints;
child.layout(childConstraints, parentUsesSize: true);
......@@ -896,14 +887,12 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
required Size requestedSize,
super.alignment,
super.textDirection,
}) : assert(requestedSize != null),
_requestedSize = requestedSize;
}) : _requestedSize = requestedSize;
/// The size this render box should attempt to be.
Size get requestedSize => _requestedSize;
Size _requestedSize;
set requestedSize(Size value) {
assert(value != null);
if (_requestedSize == value) {
return;
}
......@@ -1212,15 +1201,13 @@ class RenderCustomSingleChildLayoutBox extends RenderShiftedBox {
RenderCustomSingleChildLayoutBox({
RenderBox? child,
required SingleChildLayoutDelegate delegate,
}) : assert(delegate != null),
_delegate = delegate,
}) : _delegate = delegate,
super(child);
/// A delegate that controls this object's layout.
SingleChildLayoutDelegate get delegate => _delegate;
SingleChildLayoutDelegate _delegate;
set delegate(SingleChildLayoutDelegate newDelegate) {
assert(newDelegate != null);
if (_delegate == newDelegate) {
return;
}
......@@ -1333,9 +1320,7 @@ class RenderBaseline extends RenderShiftedBox {
RenderBox? child,
required double baseline,
required TextBaseline baselineType,
}) : assert(baseline != null),
assert(baselineType != null),
_baseline = baseline,
}) : _baseline = baseline,
_baselineType = baselineType,
super(child);
......@@ -1344,7 +1329,6 @@ class RenderBaseline extends RenderShiftedBox {
double get baseline => _baseline;
double _baseline;
set baseline(double value) {
assert(value != null);
if (_baseline == value) {
return;
}
......@@ -1356,7 +1340,6 @@ class RenderBaseline extends RenderShiftedBox {
TextBaseline get baselineType => _baselineType;
TextBaseline _baselineType;
set baselineType(TextBaseline value) {
assert(value != null);
if (_baselineType == value) {
return;
}
......
......@@ -32,8 +32,7 @@ class RenderSliverFillViewport extends RenderSliverFixedExtentBoxAdaptor {
RenderSliverFillViewport({
required super.childManager,
double viewportFraction = 1.0,
}) : assert(viewportFraction != null),
assert(viewportFraction > 0.0),
}) : assert(viewportFraction > 0.0),
_viewportFraction = viewportFraction;
@override
......@@ -47,7 +46,6 @@ class RenderSliverFillViewport extends RenderSliverFixedExtentBoxAdaptor {
double get viewportFraction => _viewportFraction;
double _viewportFraction;
set viewportFraction(double value) {
assert(value != null);
if (_viewportFraction == value) {
return;
}
......
......@@ -257,7 +257,6 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
child.layout(childConstraints);
}
trailingChildWithLayout = child;
assert(child != null);
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
assert(childParentData.index == index);
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, childParentData.index!);
......@@ -351,7 +350,6 @@ class RenderSliverFixedExtentList extends RenderSliverFixedExtentBoxAdaptor {
double get itemExtent => _itemExtent;
double _itemExtent;
set itemExtent(double value) {
assert(value != null);
if (_itemExtent == value) {
return;
}
......
......@@ -155,12 +155,11 @@ class SliverGridRegularTileLayout extends SliverGridLayout {
required this.childMainAxisExtent,
required this.childCrossAxisExtent,
required this.reverseCrossAxis,
}) : assert(crossAxisCount != null && crossAxisCount > 0),
assert(mainAxisStride != null && mainAxisStride >= 0),
assert(crossAxisStride != null && crossAxisStride >= 0),
assert(childMainAxisExtent != null && childMainAxisExtent >= 0),
assert(childCrossAxisExtent != null && childCrossAxisExtent >= 0),
assert(reverseCrossAxis != null);
}) : assert(crossAxisCount > 0),
assert(mainAxisStride >= 0),
assert(crossAxisStride >= 0),
assert(childMainAxisExtent >= 0),
assert(childCrossAxisExtent >= 0);
/// The number of children in the cross axis.
final int crossAxisCount;
......@@ -226,7 +225,6 @@ class SliverGridRegularTileLayout extends SliverGridLayout {
@override
double computeMaxScrollOffset(int childCount) {
assert(childCount != null);
final int mainAxisCount = ((childCount - 1) ~/ crossAxisCount) + 1;
final double mainAxisSpacing = mainAxisStride - childMainAxisExtent;
return mainAxisStride * mainAxisCount - mainAxisSpacing;
......@@ -317,10 +315,10 @@ class SliverGridDelegateWithFixedCrossAxisCount extends SliverGridDelegate {
this.crossAxisSpacing = 0.0,
this.childAspectRatio = 1.0,
this.mainAxisExtent,
}) : assert(crossAxisCount != null && crossAxisCount > 0),
assert(mainAxisSpacing != null && mainAxisSpacing >= 0),
assert(crossAxisSpacing != null && crossAxisSpacing >= 0),
assert(childAspectRatio != null && childAspectRatio > 0);
}) : assert(crossAxisCount > 0),
assert(mainAxisSpacing >= 0),
assert(crossAxisSpacing >= 0),
assert(childAspectRatio > 0);
/// The number of children in the cross axis.
final int crossAxisCount;
......@@ -416,10 +414,10 @@ class SliverGridDelegateWithMaxCrossAxisExtent extends SliverGridDelegate {
this.crossAxisSpacing = 0.0,
this.childAspectRatio = 1.0,
this.mainAxisExtent,
}) : assert(maxCrossAxisExtent != null && maxCrossAxisExtent > 0),
assert(mainAxisSpacing != null && mainAxisSpacing >= 0),
assert(crossAxisSpacing != null && crossAxisSpacing >= 0),
assert(childAspectRatio != null && childAspectRatio > 0);
}) : assert(maxCrossAxisExtent > 0),
assert(mainAxisSpacing >= 0),
assert(crossAxisSpacing >= 0),
assert(childAspectRatio > 0);
/// The maximum extent of tiles in the cross axis.
///
......@@ -525,8 +523,7 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
RenderSliverGrid({
required super.childManager,
required SliverGridDelegate gridDelegate,
}) : assert(gridDelegate != null),
_gridDelegate = gridDelegate;
}) : _gridDelegate = gridDelegate;
@override
void setupParentData(RenderObject child) {
......@@ -539,7 +536,6 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
SliverGridDelegate get gridDelegate => _gridDelegate;
SliverGridDelegate _gridDelegate;
set gridDelegate(SliverGridDelegate value) {
assert(value != null);
if (_gridDelegate == value) {
return;
}
......@@ -640,7 +636,6 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
child.layout(childConstraints);
}
trailingChildWithLayout = child;
assert(child != null);
final SliverGridParentData childParentData = child.parentData! as SliverGridParentData;
childParentData.layoutOffset = gridGeometry.scrollOffset;
childParentData.crossAxisOffset = gridGeometry.crossAxisOffset;
......
......@@ -188,8 +188,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
/// The [childManager] argument must not be null.
RenderSliverMultiBoxAdaptor({
required RenderSliverBoxChildManager childManager,
}) : assert(childManager != null),
_childManager = childManager {
}) : _childManager = childManager {
assert(() {
_debugDanglingKeepAlives = <RenderBox>[];
return true;
......@@ -229,7 +228,6 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
bool get debugChildIntegrityEnabled => _debugChildIntegrityEnabled;
bool _debugChildIntegrityEnabled = true;
set debugChildIntegrityEnabled(bool enabled) {
assert(enabled != null);
assert(() {
_debugChildIntegrityEnabled = enabled;
return _debugVerifyChildOrder() &&
......@@ -536,7 +534,6 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
/// Returns the index of the given child, as given by the
/// [SliverMultiBoxAdaptorParentData.index] field of the child's [parentData].
int indexOf(RenderBox child) {
assert(child != null);
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
assert(childParentData.index != null);
return childParentData.index!;
......@@ -546,7 +543,6 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
/// child's [RenderBox.size] property. This is only valid after layout.
@protected
double paintExtentOf(RenderBox child) {
assert(child != null);
assert(child.hasSize);
switch (constraints.axis) {
case Axis.horizontal:
......@@ -576,7 +572,6 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
@override
double? childScrollOffset(RenderObject child) {
assert(child != null);
assert(child.parent == this);
final SliverMultiBoxAdaptorParentData childParentData = child.parentData! as SliverMultiBoxAdaptorParentData;
return childParentData.layoutOffset;
......@@ -640,8 +635,6 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
addExtent = true;
break;
}
assert(mainAxisUnit != null);
assert(addExtent != null);
RenderBox? child = firstChild;
while (child != null) {
final double mainAxisDelta = childMainAxisPosition(child);
......
......@@ -35,9 +35,6 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
/// Only valid after layout has started, since before layout the render object
/// doesn't know what direction it will be laid out in.
double get beforePadding {
assert(constraints != null);
assert(constraints.axisDirection != null);
assert(constraints.growthDirection != null);
assert(resolvedPadding != null);
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
......@@ -56,9 +53,6 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
/// Only valid after layout has started, since before layout the render object
/// doesn't know what direction it will be laid out in.
double get afterPadding {
assert(constraints != null);
assert(constraints.axisDirection != null);
assert(constraints.growthDirection != null);
assert(resolvedPadding != null);
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
......@@ -79,8 +73,6 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
/// Only valid after layout has started, since before layout the render object
/// doesn't know what direction it will be laid out in.
double get mainAxisPadding {
assert(constraints != null);
assert(constraints.axis != null);
assert(resolvedPadding != null);
return resolvedPadding!.along(constraints.axis);
}
......@@ -92,8 +84,6 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
/// Only valid after layout has started, since before layout the render object
/// doesn't know what direction it will be laid out in.
double get crossAxisPadding {
assert(constraints != null);
assert(constraints.axis != null);
assert(resolvedPadding != null);
switch (constraints.axis) {
case Axis.horizontal:
......@@ -201,8 +191,6 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
);
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
assert(constraints.axisDirection != null);
assert(constraints.growthDirection != null);
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
childParentData.paintOffset = Offset(resolvedPadding!.left, calculatePaintOffset(constraints, from: resolvedPadding!.bottom + childLayoutGeometry.scrollExtent, to: resolvedPadding!.bottom + childLayoutGeometry.scrollExtent + resolvedPadding!.top));
......@@ -217,7 +205,6 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
childParentData.paintOffset = Offset(calculatePaintOffset(constraints, from: resolvedPadding!.right + childLayoutGeometry.scrollExtent, to: resolvedPadding!.right + childLayoutGeometry.scrollExtent + resolvedPadding!.left), resolvedPadding!.top);
break;
}
assert(childParentData.paintOffset != null);
assert(beforePadding == this.beforePadding);
assert(afterPadding == this.afterPadding);
assert(mainAxisPadding == this.mainAxisPadding);
......@@ -242,18 +229,13 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
@override
double childMainAxisPosition(RenderSliver child) {
assert(child != null);
assert(child == this.child);
return calculatePaintOffset(constraints, from: 0.0, to: beforePadding);
}
@override
double childCrossAxisPosition(RenderSliver child) {
assert(child != null);
assert(child == this.child);
assert(constraints != null);
assert(constraints.axisDirection != null);
assert(constraints.growthDirection != null);
assert(resolvedPadding != null);
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
......@@ -273,7 +255,6 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
@override
void applyPaintTransform(RenderObject child, Matrix4 transform) {
assert(child != null);
assert(child == this.child);
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
childParentData.applyPaintTransform(transform);
......@@ -326,8 +307,7 @@ class RenderSliverPadding extends RenderSliverEdgeInsetsPadding {
required EdgeInsetsGeometry padding,
TextDirection? textDirection,
RenderSliver? child,
}) : assert(padding != null),
assert(padding.isNonNegative),
}) : assert(padding.isNonNegative),
_padding = padding,
_textDirection = textDirection {
this.child = child;
......@@ -357,7 +337,6 @@ class RenderSliverPadding extends RenderSliverEdgeInsetsPadding {
EdgeInsetsGeometry get padding => _padding;
EdgeInsetsGeometry _padding;
set padding(EdgeInsetsGeometry value) {
assert(value != null);
assert(padding.isNonNegative);
if (_padding == value) {
return;
......
......@@ -37,7 +37,7 @@ class OverScrollHeaderStretchConfiguration {
OverScrollHeaderStretchConfiguration({
this.stretchTriggerOffset = 100.0,
this.onStretchTrigger,
}) : assert(stretchTriggerOffset != null);
});
/// The offset of overscroll required to trigger the [onStretchTrigger].
final double stretchTriggerOffset;
......@@ -152,7 +152,6 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
return 0.0;
}
assert(child!.hasSize);
assert(constraints.axis != null);
switch (constraints.axis) {
case Axis.vertical:
return child!.size.height;
......@@ -217,7 +216,6 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
/// The `overlapsContent` argument is passed to [updateChild].
@protected
void layoutChild(double scrollOffset, double maxExtent, { bool overlapsContent = false }) {
assert(maxExtent != null);
final double shrinkOffset = math.min(scrollOffset, maxExtent);
if (_needsUpdateChild || _lastShrinkOffset != shrinkOffset || _lastOverlapsContent != overlapsContent) {
invokeLayoutCallback<SliverConstraints>((SliverConstraints constraints) {
......@@ -228,7 +226,6 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
_lastOverlapsContent = overlapsContent;
_needsUpdateChild = false;
}
assert(minExtent != null);
assert(() {
if (minExtent <= maxExtent) {
return true;
......@@ -294,7 +291,6 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
@override
void applyPaintTransform(RenderObject child, Matrix4 transform) {
assert(child != null);
assert(child == this.child);
applyPaintTransformForBoxChild(child as RenderBox, transform);
}
......@@ -302,7 +298,6 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
@override
void paint(PaintingContext context, Offset offset) {
if (child != null && geometry!.visible) {
assert(constraints.axisDirection != null);
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
offset += Offset(0.0, geometry!.paintExtent - childMainAxisPosition(child!) - childExtent);
......@@ -496,8 +491,7 @@ class FloatingHeaderSnapConfiguration {
FloatingHeaderSnapConfiguration({
this.curve = Curves.ease,
this.duration = const Duration(milliseconds: 300),
}) : assert(curve != null),
assert(duration != null);
});
/// The snap animation curve.
final Curve curve;
......@@ -607,9 +601,6 @@ abstract class RenderSliverFloatingPersistentHeader extends RenderSliverPersiste
}
void _updateAnimation(Duration duration, double endValue, Curve curve) {
assert(duration != null);
assert(endValue != null);
assert(curve != null);
assert(
vsync != null,
'vsync must not be null if the floating header changes size animatedly.',
......
......@@ -25,8 +25,7 @@ class RelativeRect {
/// Creates a RelativeRect with the given values.
///
/// The arguments must not be null.
const RelativeRect.fromLTRB(this.left, this.top, this.right, this.bottom)
: assert(left != null && top != null && right != null && bottom != null);
const RelativeRect.fromLTRB(this.left, this.top, this.right, this.bottom);
/// Creates a RelativeRect from a Rect and a Size. The Rect (first argument)
/// and the RelativeRect (the output) are in the coordinate space of the
......@@ -166,7 +165,6 @@ class RelativeRect {
///
/// {@macro dart.ui.shadow.lerp}
static RelativeRect? lerp(RelativeRect? a, RelativeRect? b, double t) {
assert(t != null);
if (a == null && b == null) {
return null;
}
......@@ -354,10 +352,7 @@ class RenderStack extends RenderBox
TextDirection? textDirection,
StackFit fit = StackFit.loose,
Clip clipBehavior = Clip.hardEdge,
}) : assert(alignment != null),
assert(fit != null),
assert(clipBehavior != null),
_alignment = alignment,
}) : _alignment = alignment,
_textDirection = textDirection,
_fit = fit,
_clipBehavior = clipBehavior {
......@@ -405,7 +400,6 @@ class RenderStack extends RenderBox
AlignmentGeometry get alignment => _alignment;
AlignmentGeometry _alignment;
set alignment(AlignmentGeometry value) {
assert(value != null);
if (_alignment == value) {
return;
}
......@@ -435,7 +429,6 @@ class RenderStack extends RenderBox
StackFit get fit => _fit;
StackFit _fit;
set fit(StackFit value) {
assert(value != null);
if (_fit != value) {
_fit = value;
markNeedsLayout();
......@@ -448,7 +441,6 @@ class RenderStack extends RenderBox
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......@@ -571,7 +563,6 @@ class RenderStack extends RenderBox
double height = constraints.minHeight;
final BoxConstraints nonPositionedConstraints;
assert(fit != null);
switch (fit) {
case StackFit.loose:
nonPositionedConstraints = constraints.loosen();
......@@ -583,7 +574,6 @@ class RenderStack extends RenderBox
nonPositionedConstraints = constraints;
break;
}
assert(nonPositionedConstraints != null);
RenderBox? child = firstChild;
while (child != null) {
......@@ -755,7 +745,6 @@ class RenderIndexedStack extends RenderStack {
if (firstChild == null || index == null) {
return false;
}
assert(position != null);
final RenderBox child = _childAtIndex();
final StackParentData childParentData = child.parentData! as StackParentData;
return result.addWithPaintOffset(
......
......@@ -134,7 +134,7 @@ class FixedColumnWidth extends TableColumnWidth {
/// Creates a column width based on a fixed number of logical pixels.
///
/// The [value] argument must not be null.
const FixedColumnWidth(this.value) : assert(value != null);
const FixedColumnWidth(this.value);
/// The width the column should occupy in logical pixels.
final double value;
......@@ -161,7 +161,7 @@ class FractionColumnWidth extends TableColumnWidth {
/// maxWidth.
///
/// The [value] argument must not be null.
const FractionColumnWidth(this.value) : assert(value != null);
const FractionColumnWidth(this.value);
/// The fraction of the table's constraints' maxWidth that this column should
/// occupy.
......@@ -199,7 +199,7 @@ class FlexColumnWidth extends TableColumnWidth {
/// the other columns have been laid out.
///
/// The [value] argument must not be null.
const FlexColumnWidth([this.value = 1.0]) : assert(value != null);
const FlexColumnWidth([this.value = 1.0]);
/// The fraction of the remaining space once all the other columns have
/// been laid out that this column should occupy.
......@@ -388,9 +388,6 @@ class RenderTable extends RenderBox {
}) : assert(columns == null || columns >= 0),
assert(rows == null || rows >= 0),
assert(rows == null || children == null),
assert(defaultColumnWidth != null),
assert(textDirection != null),
assert(configuration != null),
_textDirection = textDirection,
_columns = columns ?? (children != null && children.isNotEmpty ? children.first.length : 0),
_rows = rows ?? 0,
......@@ -419,7 +416,6 @@ class RenderTable extends RenderBox {
int get columns => _columns;
int _columns;
set columns(int value) {
assert(value != null);
assert(value >= 0);
if (value == columns) {
return;
......@@ -454,7 +450,6 @@ class RenderTable extends RenderBox {
int get rows => _rows;
int _rows;
set rows(int value) {
assert(value != null);
assert(value >= 0);
if (value == rows) {
return;
......@@ -513,7 +508,6 @@ class RenderTable extends RenderBox {
TableColumnWidth get defaultColumnWidth => _defaultColumnWidth;
TableColumnWidth _defaultColumnWidth;
set defaultColumnWidth(TableColumnWidth value) {
assert(value != null);
if (defaultColumnWidth == value) {
return;
}
......@@ -525,7 +519,6 @@ class RenderTable extends RenderBox {
TextDirection get textDirection => _textDirection;
TextDirection _textDirection;
set textDirection(TextDirection value) {
assert(value != null);
if (_textDirection == value) {
return;
}
......@@ -573,7 +566,6 @@ class RenderTable extends RenderBox {
ImageConfiguration get configuration => _configuration;
ImageConfiguration _configuration;
set configuration(ImageConfiguration value) {
assert(value != null);
if (value == _configuration) {
return;
}
......@@ -585,7 +577,6 @@ class RenderTable extends RenderBox {
TableCellVerticalAlignment get defaultVerticalAlignment => _defaultVerticalAlignment;
TableCellVerticalAlignment _defaultVerticalAlignment;
set defaultVerticalAlignment(TableCellVerticalAlignment value) {
assert(value != null);
if (_defaultVerticalAlignment == value) {
return;
}
......@@ -626,7 +617,7 @@ class RenderTable extends RenderBox {
assert(columns >= 0);
// consider the case of a newly empty table
if (columns == 0 || cells.isEmpty) {
assert(cells == null || cells.isEmpty);
assert(cells.isEmpty);
_columns = columns;
if (_children.isEmpty) {
assert(_rows == 0);
......@@ -642,7 +633,6 @@ class RenderTable extends RenderBox {
markNeedsLayout();
return;
}
assert(cells != null);
assert(cells.length % columns == 0);
// fill a set with the cells that are moving (it's important not
// to dropChild a child that's remaining with us, because that
......@@ -722,8 +712,6 @@ class RenderTable extends RenderBox {
/// does not modify the table. Otherwise, the given child must not already
/// have a parent.
void setChild(int x, int y, RenderBox? value) {
assert(x != null);
assert(y != null);
assert(x >= 0 && x < columns && y >= 0 && y < rows);
assert(_children.length == rows * columns);
final int xy = x + y * columns;
......@@ -864,7 +852,6 @@ class RenderTable extends RenderBox {
}
List<double> _computeColumnWidths(BoxConstraints constraints) {
assert(constraints != null);
assert(_children.length == rows * columns);
// We apply the constraints to the column widths in the order of
// least important to most important:
......@@ -1061,7 +1048,6 @@ class RenderTable extends RenderBox {
final RenderBox? child = _children[xy];
if (child != null) {
final TableCellParentData childParentData = child.parentData! as TableCellParentData;
assert(childParentData != null);
switch (childParentData.verticalAlignment ?? defaultVerticalAlignment) {
case TableCellVerticalAlignment.baseline:
assert(debugCannotComputeDryLayout(
......@@ -1133,7 +1119,6 @@ class RenderTable extends RenderBox {
final RenderBox? child = _children[xy];
if (child != null) {
final TableCellParentData childParentData = child.parentData! as TableCellParentData;
assert(childParentData != null);
childParentData.x = x;
childParentData.y = y;
switch (childParentData.verticalAlignment ?? defaultVerticalAlignment) {
......
......@@ -89,12 +89,6 @@ class TableBorder {
/// Whether all the sides of the border (outside and inside) are identical.
/// Uniform borders are typically more efficient to paint.
bool get isUniform {
assert(top != null);
assert(right != null);
assert(bottom != null);
assert(left != null);
assert(horizontalInside != null);
assert(verticalInside != null);
final Color topColor = top.color;
if (right.color != topColor ||
......@@ -159,7 +153,6 @@ class TableBorder {
///
/// {@macro dart.ui.shadow.lerp}
static TableBorder? lerp(TableBorder? a, TableBorder? b, double t) {
assert(t != null);
if (a == null && b == null) {
return null;
}
......@@ -212,19 +205,9 @@ class TableBorder {
required Iterable<double> columns,
}) {
// properties can't be null
assert(top != null);
assert(right != null);
assert(bottom != null);
assert(left != null);
assert(horizontalInside != null);
assert(verticalInside != null);
// arguments can't be null
assert(canvas != null);
assert(rect != null);
assert(rows != null);
assert(rows.isEmpty || (rows.first >= 0.0 && rows.last <= rect.height));
assert(columns != null);
assert(columns.isEmpty || (columns.first >= 0.0 && columns.last <= rect.width));
if (columns.isNotEmpty || rows.isNotEmpty) {
......
......@@ -40,8 +40,7 @@ class TextureBox extends RenderBox {
required int textureId,
bool freeze = false,
FilterQuality filterQuality = FilterQuality.low,
}) : assert(textureId != null),
_textureId = textureId,
}) : _textureId = textureId,
_freeze = freeze,
_filterQuality = filterQuality;
......@@ -49,7 +48,6 @@ class TextureBox extends RenderBox {
int get textureId => _textureId;
int _textureId;
set textureId(int value) {
assert(value != null);
if (value != _textureId) {
_textureId = value;
markNeedsPaint();
......@@ -60,7 +58,6 @@ class TextureBox extends RenderBox {
bool get freeze => _freeze;
bool _freeze;
set freeze(bool value) {
assert(value != null);
if (value != _freeze) {
_freeze = value;
markNeedsPaint();
......@@ -71,7 +68,6 @@ class TextureBox extends RenderBox {
FilterQuality get filterQuality => _filterQuality;
FilterQuality _filterQuality;
set filterQuality(FilterQuality value) {
assert(value != null);
if (value != _filterQuality) {
_filterQuality = value;
markNeedsPaint();
......
......@@ -69,8 +69,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
RenderBox? child,
required ViewConfiguration configuration,
required ui.FlutterView window,
}) : assert(configuration != null),
_configuration = configuration,
}) : _configuration = configuration,
_window = window {
this.child = child;
}
......@@ -88,7 +87,6 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
///
/// Always call [prepareInitialFrame] before changing the configuration.
set configuration(ViewConfiguration value) {
assert(value != null);
if (configuration == value) {
return;
}
......@@ -201,7 +199,6 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
/// * [Layer.findAllAnnotations], which is used by this method to find all
/// [AnnotatedRegionLayer]s annotated for mouse tracking.
HitTestResult hitTestMouseTrackers(Offset position) {
assert(position != null);
final BoxHitTestResult result = BoxHitTestResult();
hitTest(result, position: position);
return result;
......
......@@ -196,7 +196,6 @@ abstract class ViewportOffset extends ChangeNotifier {
Curve? curve,
bool? clamp,
}) {
assert(to != null);
if (duration == null || duration == Duration.zero) {
jumpTo(to);
return Future<void>.value();
......
......@@ -121,14 +121,7 @@ class RenderWrap extends RenderBox
TextDirection? textDirection,
VerticalDirection verticalDirection = VerticalDirection.down,
Clip clipBehavior = Clip.none,
}) : assert(direction != null),
assert(alignment != null),
assert(spacing != null),
assert(runAlignment != null),
assert(runSpacing != null),
assert(crossAxisAlignment != null),
assert(clipBehavior != null),
_direction = direction,
}) : _direction = direction,
_alignment = alignment,
_spacing = spacing,
_runAlignment = runAlignment,
......@@ -149,7 +142,6 @@ class RenderWrap extends RenderBox
Axis get direction => _direction;
Axis _direction;
set direction (Axis value) {
assert(value != null);
if (_direction == value) {
return;
}
......@@ -173,7 +165,6 @@ class RenderWrap extends RenderBox
WrapAlignment get alignment => _alignment;
WrapAlignment _alignment;
set alignment (WrapAlignment value) {
assert(value != null);
if (_alignment == value) {
return;
}
......@@ -195,7 +186,6 @@ class RenderWrap extends RenderBox
double get spacing => _spacing;
double _spacing;
set spacing (double value) {
assert(value != null);
if (_spacing == value) {
return;
}
......@@ -220,7 +210,6 @@ class RenderWrap extends RenderBox
WrapAlignment get runAlignment => _runAlignment;
WrapAlignment _runAlignment;
set runAlignment (WrapAlignment value) {
assert(value != null);
if (_runAlignment == value) {
return;
}
......@@ -241,7 +230,6 @@ class RenderWrap extends RenderBox
double get runSpacing => _runSpacing;
double _runSpacing;
set runSpacing (double value) {
assert(value != null);
if (_runSpacing == value) {
return;
}
......@@ -267,7 +255,6 @@ class RenderWrap extends RenderBox
WrapCrossAlignment get crossAxisAlignment => _crossAxisAlignment;
WrapCrossAlignment _crossAxisAlignment;
set crossAxisAlignment (WrapCrossAlignment value) {
assert(value != null);
if (_crossAxisAlignment == value) {
return;
}
......@@ -344,7 +331,6 @@ class RenderWrap extends RenderBox
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
......@@ -353,10 +339,6 @@ class RenderWrap extends RenderBox
}
bool get _debugHasNecessaryDirections {
assert(direction != null);
assert(alignment != null);
assert(runAlignment != null);
assert(crossAxisAlignment != null);
if (firstChild != null && lastChild != firstChild) {
// i.e. there's more than one child
switch (direction) {
......@@ -364,7 +346,6 @@ class RenderWrap extends RenderBox
assert(textDirection != null, 'Horizontal $runtimeType with multiple children has a null textDirection, so the layout order is undefined.');
break;
case Axis.vertical:
assert(verticalDirection != null, 'Vertical $runtimeType with multiple children has a null verticalDirection, so the layout order is undefined.');
break;
}
}
......@@ -374,14 +355,12 @@ class RenderWrap extends RenderBox
assert(textDirection != null, 'Horizontal $runtimeType with alignment $alignment has a null textDirection, so the alignment cannot be resolved.');
break;
case Axis.vertical:
assert(verticalDirection != null, 'Vertical $runtimeType with alignment $alignment has a null verticalDirection, so the alignment cannot be resolved.');
break;
}
}
if (runAlignment == WrapAlignment.start || runAlignment == WrapAlignment.end) {
switch (direction) {
case Axis.horizontal:
assert(verticalDirection != null, 'Horizontal $runtimeType with runAlignment $runAlignment has a null verticalDirection, so the alignment cannot be resolved.');
break;
case Axis.vertical:
assert(textDirection != null, 'Vertical $runtimeType with runAlignment $runAlignment has a null textDirection, so the alignment cannot be resolved.');
......@@ -391,7 +370,6 @@ class RenderWrap extends RenderBox
if (crossAxisAlignment == WrapCrossAlignment.start || crossAxisAlignment == WrapCrossAlignment.end) {
switch (direction) {
case Axis.horizontal:
assert(verticalDirection != null, 'Horizontal $runtimeType with crossAxisAlignment $crossAxisAlignment has a null verticalDirection, so the alignment cannot be resolved.');
break;
case Axis.vertical:
assert(textDirection != null, 'Vertical $runtimeType with crossAxisAlignment $crossAxisAlignment has a null textDirection, so the alignment cannot be resolved.');
......@@ -610,8 +588,6 @@ class RenderWrap extends RenderBox
}
break;
}
assert(childConstraints != null);
assert(mainAxisLimit != null);
final double spacing = this.spacing;
final double runSpacing = this.runSpacing;
final List<_RunMetrics> runMetrics = <_RunMetrics>[];
......
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