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

This commit is contained in:
Michael Goderbauer
2023-01-20 17:34:50 -08:00
committed by GitHub
parent bae4c1d243
commit 9837eb6fc5
37 changed files with 127 additions and 757 deletions

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -42,8 +42,7 @@ class TextSelectionPoint {
/// Creates a description of a point in a text selection.
///
/// The [point] argument must not be null.
const TextSelectionPoint(this.point, this.direction)
: assert(point != null);
const TextSelectionPoint(this.point, this.direction);
/// Coordinates of the lower left or lower right corner of the selection,
/// relative to the top left of the [RenderEditable] object.
@@ -325,37 +324,19 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
RenderEditablePainter? painter,
RenderEditablePainter? foregroundPainter,
List<RenderBox>? children,
}) : assert(textAlign != null),
assert(textDirection != null, 'RenderEditable created without a textDirection.'),
assert(maxLines == null || maxLines > 0),
}) : assert(maxLines == null || maxLines > 0),
assert(minLines == null || minLines > 0),
assert(startHandleLayerLink != null),
assert(endHandleLayerLink != null),
assert(
(maxLines == null) || (minLines == null) || (maxLines >= minLines),
"minLines can't be greater than maxLines",
),
assert(expands != null),
assert(
!expands || (maxLines == null && minLines == null),
'minLines and maxLines must be null when expands is true.',
),
assert(textScaleFactor != null),
assert(offset != null),
assert(ignorePointer != null),
assert(textWidthBasis != null),
assert(paintCursorAboveText != null),
assert(obscuringCharacter != null && obscuringCharacter.characters.length == 1),
assert(obscureText != null),
assert(textSelectionDelegate != null),
assert(cursorWidth != null && cursorWidth >= 0.0),
assert(obscuringCharacter.characters.length == 1),
assert(cursorWidth >= 0.0),
assert(cursorHeight == null || cursorHeight >= 0.0),
assert(readOnly != null),
assert(forceLine != null),
assert(devicePixelRatio != null),
assert(selectionHeightStyle != null),
assert(selectionWidthStyle != null),
assert(clipBehavior != null),
_textPainter = TextPainter(
text: text,
textAlign: textAlign,
@@ -386,7 +367,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
_forceLine = forceLine,
_clipBehavior = clipBehavior,
_hasFocus = hasFocus ?? false {
assert(_showCursor != null);
assert(!_showCursor.value || cursorColor != null);
_selectionPainter.highlightColor = selectionColor;
@@ -592,7 +572,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
/// {@macro flutter.painting.textPainter.textWidthBasis}
TextWidthBasis get textWidthBasis => _textPainter.textWidthBasis;
set textWidthBasis(TextWidthBasis value) {
assert(value != null);
if (_textPainter.textWidthBasis == value) {
return;
}
@@ -622,7 +601,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
if (_obscuringCharacter == value) {
return;
}
assert(value != null && value.characters.length == 1);
assert(value.characters.length == 1);
_obscuringCharacter = value;
markNeedsLayout();
}
@@ -852,7 +831,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
/// This must not be null.
TextAlign get textAlign => _textPainter.textAlign;
set textAlign(TextAlign value) {
assert(value != null);
if (_textPainter.textAlign == value) {
return;
}
@@ -878,7 +856,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
// set it to null here, so _textPainter.textDirection cannot be null.
TextDirection get textDirection => _textPainter.textDirection!;
set textDirection(TextDirection value) {
assert(value != null);
if (_textPainter.textDirection == value) {
return;
}
@@ -936,7 +913,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
ValueNotifier<bool> get showCursor => _showCursor;
ValueNotifier<bool> _showCursor;
set showCursor(ValueNotifier<bool> value) {
assert(value != null);
if (_showCursor == value) {
return;
}
@@ -958,7 +934,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
bool get hasFocus => _hasFocus;
bool _hasFocus = false;
set hasFocus(bool value) {
assert(value != null);
if (_hasFocus == value) {
return;
}
@@ -970,7 +945,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
bool get forceLine => _forceLine;
bool _forceLine = false;
set forceLine(bool value) {
assert(value != null);
if (_forceLine == value) {
return;
}
@@ -982,7 +956,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
bool get readOnly => _readOnly;
bool _readOnly = false;
set readOnly(bool value) {
assert(value != null);
if (_readOnly == value) {
return;
}
@@ -1034,7 +1007,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
bool get expands => _expands;
bool _expands;
set expands(bool value) {
assert(value != null);
if (expands == value) {
return;
}
@@ -1054,7 +1026,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
/// the specified font size.
double get textScaleFactor => _textPainter.textScaleFactor;
set textScaleFactor(double value) {
assert(value != null);
if (_textPainter.textScaleFactor == value) {
return;
}
@@ -1088,7 +1059,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
ViewportOffset get offset => _offset;
ViewportOffset _offset;
set offset(ViewportOffset value) {
assert(value != null);
if (_offset == value) {
return;
}
@@ -1295,7 +1265,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
@@ -1605,7 +1574,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
TextRange? _getNextWord(int offset) {
while (true) {
final TextRange range = _textPainter.getWordBoundary(TextPosition(offset: offset));
if (range == null || !range.isValid || range.isCollapsed) {
if (!range.isValid || range.isCollapsed) {
return null;
}
if (!_onlyWhitespace(range)) {
@@ -1618,7 +1587,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
TextRange? _getPreviousWord(int offset) {
while (offset >= 0) {
final TextRange range = _textPainter.getWordBoundary(TextPosition(offset: offset));
if (range == null || !range.isValid || range.isCollapsed) {
if (!range.isValid || range.isCollapsed) {
return null;
}
if (!_onlyWhitespace(range)) {
@@ -2078,8 +2047,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
/// [from] corresponds to the [TextSelection.baseOffset], and [to] corresponds
/// to the [TextSelection.extentOffset].
void selectPositionAt({ required Offset from, Offset? to, required SelectionChangedCause cause }) {
assert(cause != null);
assert(from != null);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
final TextPosition fromPosition = _textPainter.getPositionForOffset(globalToLocal(from - _paintOffset));
final TextPosition? toPosition = to == null
@@ -2117,8 +2084,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
///
/// {@macro flutter.rendering.RenderEditable.selectPosition}
void selectWordsInRange({ required Offset from, Offset? to, required SelectionChangedCause cause }) {
assert(cause != null);
assert(from != null);
_computeTextMetricsIfNeeded();
final TextPosition fromPosition = _textPainter.getPositionForOffset(globalToLocal(from - _paintOffset));
final TextSelection fromWord = _getWordAtOffset(fromPosition);
@@ -2140,7 +2105,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
///
/// {@macro flutter.rendering.RenderEditable.selectPosition}
void selectWordEdge({ required SelectionChangedCause cause }) {
assert(cause != null);
_computeTextMetricsIfNeeded();
assert(_lastTapDownPosition != null);
final TextPosition position = _textPainter.getPositionForOffset(globalToLocal(_lastTapDownPosition! - _paintOffset));
@@ -2187,7 +2151,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
// the position.
if (TextLayoutMetrics.isWhitespace(plainText.codeUnitAt(effectiveOffset))
&& effectiveOffset > 0) {
assert(defaultTargetPlatform != null);
final TextRange? previousWord = _getPreviousWord(word.start);
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
@@ -2311,7 +2274,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
}
void _layoutText({ double minWidth = 0.0, double maxWidth = double.infinity }) {
assert(maxWidth != null && minWidth != null);
final double availableMaxWidth = math.max(0.0, maxWidth - _caretMargin);
final double availableMinWidth = math.min(minWidth, availableMaxWidth);
final double textMaxWidth = _isMultiline ? availableMaxWidth : double.infinity;
@@ -2344,7 +2306,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
// the constraints used to layout the `_textPainter` is different. See
// `TextPainter.layout`.
void _computeTextMetricsIfNeeded() {
assert(constraints != null);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
}
@@ -2362,7 +2323,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
/// of the cursor for iOS is approximate and obtained through an eyeball
/// comparison.
void _computeCaretPrototype() {
assert(defaultTargetPlatform != null);
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
case TargetPlatform.macOS:
@@ -2524,9 +2484,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
/// Sets the screen position of the floating cursor and the text position
/// closest to the cursor.
void setFloatingCursor(FloatingCursorDragState state, Offset boundedOffset, TextPosition lastTextPosition, { double? resetLerpValue }) {
assert(state != null);
assert(boundedOffset != null);
assert(lastTextPosition != null);
if (state == FloatingCursorDragState.Start) {
_relativeOrigin = Offset.zero;
_previousOffset = null;
@@ -2877,7 +2834,6 @@ class _TextHighlightPainter extends RenderEditablePainter {
ui.BoxHeightStyle get selectionHeightStyle => _selectionHeightStyle;
ui.BoxHeightStyle _selectionHeightStyle = ui.BoxHeightStyle.tight;
set selectionHeightStyle(ui.BoxHeightStyle value) {
assert(value != null);
if (_selectionHeightStyle == value) {
return;
}
@@ -2891,7 +2847,6 @@ class _TextHighlightPainter extends RenderEditablePainter {
ui.BoxWidthStyle get selectionWidthStyle => _selectionWidthStyle;
ui.BoxWidthStyle _selectionWidthStyle = ui.BoxWidthStyle.tight;
set selectionWidthStyle(ui.BoxWidthStyle value) {
assert(value != null);
if (_selectionWidthStyle == value) {
return;
}
@@ -3070,7 +3025,6 @@ class _FloatingCursorPainter extends RenderEditablePainter {
void paint(Canvas canvas, Size size, RenderEditable renderEditable) {
// Compute the caret location even when `shouldPaint` is false.
assert(renderEditable != null);
final TextSelection? selection = renderEditable.selection;
// TODO(LongCatIsLooong): skip painting the caret when the selection is

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -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.

View File

@@ -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));

View File

@@ -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!;

View File

@@ -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)) {

View File

@@ -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,

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -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 '

View File

@@ -220,8 +220,7 @@ class RenderConstrainedBox extends RenderProxyBox {
RenderConstrainedBox({
RenderBox? child,
required BoxConstraints additionalConstraints,
}) : assert(additionalConstraints != null),
assert(additionalConstraints.debugAssertIsValid()),
}) : assert(additionalConstraints.debugAssertIsValid()),
_additionalConstraints = additionalConstraints,
super(child);
@@ -229,7 +228,6 @@ class RenderConstrainedBox extends RenderProxyBox {
BoxConstraints get additionalConstraints => _additionalConstraints;
BoxConstraints _additionalConstraints;
set additionalConstraints(BoxConstraints value) {
assert(value != null);
assert(value.debugAssertIsValid());
if (_additionalConstraints == value) {
return;
@@ -353,8 +351,8 @@ class RenderLimitedBox extends RenderProxyBox {
RenderBox? child,
double maxWidth = double.infinity,
double maxHeight = double.infinity,
}) : assert(maxWidth != null && maxWidth >= 0.0),
assert(maxHeight != null && maxHeight >= 0.0),
}) : assert(maxWidth >= 0.0),
assert(maxHeight >= 0.0),
_maxWidth = maxWidth,
_maxHeight = maxHeight,
super(child);
@@ -363,7 +361,7 @@ class RenderLimitedBox extends RenderProxyBox {
double get maxWidth => _maxWidth;
double _maxWidth;
set maxWidth(double value) {
assert(value != null && value >= 0.0);
assert(value >= 0.0);
if (_maxWidth == value) {
return;
}
@@ -375,7 +373,7 @@ class RenderLimitedBox extends RenderProxyBox {
double get maxHeight => _maxHeight;
double _maxHeight;
set maxHeight(double value) {
assert(value != null && value >= 0.0);
assert(value >= 0.0);
if (_maxHeight == value) {
return;
}
@@ -457,8 +455,7 @@ class RenderAspectRatio extends RenderProxyBox {
RenderAspectRatio({
RenderBox? child,
required double aspectRatio,
}) : assert(aspectRatio != null),
assert(aspectRatio > 0.0),
}) : assert(aspectRatio > 0.0),
assert(aspectRatio.isFinite),
_aspectRatio = aspectRatio,
super(child);
@@ -470,7 +467,6 @@ class RenderAspectRatio extends RenderProxyBox {
double get aspectRatio => _aspectRatio;
double _aspectRatio;
set aspectRatio(double value) {
assert(value != null);
assert(value > 0.0);
assert(value.isFinite);
if (_aspectRatio == value) {
@@ -879,9 +875,7 @@ class RenderOpacity extends RenderProxyBox {
double opacity = 1.0,
bool alwaysIncludeSemantics = false,
RenderBox? child,
}) : assert(opacity != null),
assert(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),
@@ -908,7 +902,6 @@ class RenderOpacity extends RenderProxyBox {
double get opacity => _opacity;
double _opacity;
set opacity(double value) {
assert(value != null);
assert(value >= 0.0 && value <= 1.0);
if (_opacity == value) {
return;
@@ -1009,7 +1002,6 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
Animation<double> get opacity => _opacity!;
Animation<double>? _opacity;
set opacity(Animation<double> value) {
assert(value != null);
if (_opacity == value) {
return;
}
@@ -1111,9 +1103,7 @@ class RenderAnimatedOpacity extends RenderProxyBox with RenderProxyBoxMixin, Ren
required Animation<double> opacity,
bool alwaysIncludeSemantics = false,
RenderBox? child,
}) : assert(opacity != null),
assert(alwaysIncludeSemantics != null),
super(child) {
}) : super(child) {
this.opacity = opacity;
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
}
@@ -1136,9 +1126,7 @@ class RenderShaderMask extends RenderProxyBox {
RenderBox? child,
required ShaderCallback shaderCallback,
BlendMode blendMode = BlendMode.modulate,
}) : assert(shaderCallback != null),
assert(blendMode != null),
_shaderCallback = shaderCallback,
}) : _shaderCallback = shaderCallback,
_blendMode = blendMode,
super(child);
@@ -1157,7 +1145,6 @@ class RenderShaderMask extends RenderProxyBox {
ShaderCallback get shaderCallback => _shaderCallback;
ShaderCallback _shaderCallback;
set shaderCallback(ShaderCallback value) {
assert(value != null);
if (_shaderCallback == value) {
return;
}
@@ -1172,7 +1159,6 @@ class RenderShaderMask extends RenderProxyBox {
BlendMode get blendMode => _blendMode;
BlendMode _blendMode;
set blendMode(BlendMode value) {
assert(value != null);
if (_blendMode == value) {
return;
}
@@ -1214,9 +1200,7 @@ class RenderBackdropFilter extends RenderProxyBox {
/// The [blendMode] argument, if provided, must not be null
/// and will default to [BlendMode.srcOver].
RenderBackdropFilter({ RenderBox? child, required ui.ImageFilter filter, BlendMode blendMode = BlendMode.srcOver })
: assert(filter != null),
assert(blendMode != null),
_filter = filter,
: _filter = filter,
_blendMode = blendMode,
super(child);
@@ -1231,7 +1215,6 @@ class RenderBackdropFilter extends RenderProxyBox {
ui.ImageFilter get filter => _filter;
ui.ImageFilter _filter;
set filter(ui.ImageFilter value) {
assert(value != null);
if (_filter == value) {
return;
}
@@ -1246,7 +1229,6 @@ class RenderBackdropFilter extends RenderProxyBox {
BlendMode get blendMode => _blendMode;
BlendMode _blendMode;
set blendMode(BlendMode value) {
assert(value != null);
if (_blendMode == value) {
return;
}
@@ -1371,7 +1353,7 @@ class ShapeBorderClipper extends CustomClipper<Path> {
const ShapeBorderClipper({
required this.shape,
this.textDirection,
}) : assert(shape != null);
});
/// The shape border whose outer path this clipper clips to.
final ShapeBorder shape;
@@ -1404,8 +1386,7 @@ abstract class _RenderCustomClip<T> extends RenderProxyBox {
RenderBox? child,
CustomClipper<T>? clipper,
Clip clipBehavior = Clip.antiAlias,
}) : assert(clipBehavior != null),
_clipper = clipper,
}) : _clipper = clipper,
_clipBehavior = clipBehavior,
super(child);
@@ -1540,7 +1521,7 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
super.child,
super.clipper,
super.clipBehavior,
}) : assert(clipBehavior != null);
});
@override
Rect get _defaultClip => Offset.zero & size;
@@ -1612,15 +1593,11 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
RenderClipRRect({
super.child,
BorderRadiusGeometry borderRadius = BorderRadius.zero,
CustomClipper<RRect>? clipper,
super.clipper,
super.clipBehavior,
TextDirection? textDirection,
}) : assert(clipBehavior != null),
_borderRadius = borderRadius,
_textDirection = textDirection,
super(clipper: clipper) {
assert(_borderRadius != null || clipper != null);
}
}) : _borderRadius = borderRadius,
_textDirection = textDirection;
/// The border radius of the rounded corners.
///
@@ -1631,7 +1608,6 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
BorderRadiusGeometry get borderRadius => _borderRadius;
BorderRadiusGeometry _borderRadius;
set borderRadius(BorderRadiusGeometry value) {
assert(value != null);
if (_borderRadius == value) {
return;
}
@@ -1720,7 +1696,7 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
super.child,
super.clipper,
super.clipBehavior,
}) : assert(clipBehavior != null);
});
Rect? _cachedRect;
late Path _cachedPath;
@@ -1816,7 +1792,7 @@ class RenderClipPath extends _RenderCustomClip<Path> {
super.child,
super.clipper,
super.clipBehavior,
}) : assert(clipBehavior != null);
});
@override
Path get _defaultClip => Path()..addRect(Offset.zero & size);
@@ -1885,10 +1861,7 @@ abstract class _RenderPhysicalModelBase<T> extends _RenderCustomClip<T> {
required Color shadowColor,
super.clipBehavior = Clip.none,
super.clipper,
}) : assert(elevation != null && elevation >= 0.0),
assert(color != null),
assert(shadowColor != null),
assert(clipBehavior != null),
}) : assert(elevation >= 0.0),
_elevation = elevation,
_color = color,
_shadowColor = shadowColor;
@@ -1902,7 +1875,7 @@ abstract class _RenderPhysicalModelBase<T> extends _RenderCustomClip<T> {
double get elevation => _elevation;
double _elevation;
set elevation(double value) {
assert(value != null && value >= 0.0);
assert(value >= 0.0);
if (elevation == value) {
return;
}
@@ -1918,7 +1891,6 @@ abstract class _RenderPhysicalModelBase<T> extends _RenderCustomClip<T> {
Color get shadowColor => _shadowColor;
Color _shadowColor;
set shadowColor(Color value) {
assert(value != null);
if (shadowColor == value) {
return;
}
@@ -1930,7 +1902,6 @@ abstract class _RenderPhysicalModelBase<T> extends _RenderCustomClip<T> {
Color get color => _color;
Color _color;
set color(Color value) {
assert(value != null);
if (color == value) {
return;
}
@@ -1975,11 +1946,7 @@ class RenderPhysicalModel extends _RenderPhysicalModelBase<RRect> {
super.elevation = 0.0,
required super.color,
super.shadowColor = const Color(0xFF000000),
}) : assert(shape != null),
assert(clipBehavior != null),
assert(elevation != null && elevation >= 0.0),
assert(color != null),
assert(shadowColor != null),
}) : assert(elevation >= 0.0),
_shape = shape,
_borderRadius = borderRadius;
@@ -1990,7 +1957,6 @@ class RenderPhysicalModel extends _RenderPhysicalModelBase<RRect> {
BoxShape get shape => _shape;
BoxShape _shape;
set shape(BoxShape value) {
assert(value != null);
if (shape == value) {
return;
}
@@ -2019,7 +1985,6 @@ class RenderPhysicalModel extends _RenderPhysicalModelBase<RRect> {
@override
RRect get _defaultClip {
assert(hasSize);
assert(_shape != null);
final Rect rect = Offset.zero & size;
switch (_shape) {
case BoxShape.rectangle:
@@ -2148,10 +2113,7 @@ class RenderPhysicalShape extends _RenderPhysicalModelBase<Path> {
super.elevation = 0.0,
required super.color,
super.shadowColor = const Color(0xFF000000),
}) : assert(clipper != null),
assert(elevation != null && elevation >= 0.0),
assert(color != null),
assert(shadowColor != null);
}) : assert(elevation >= 0.0);
@override
Path get _defaultClip => Path()..addRect(Offset.zero & size);
@@ -2274,10 +2236,7 @@ class RenderDecoratedBox extends RenderProxyBox {
DecorationPosition position = DecorationPosition.background,
ImageConfiguration configuration = ImageConfiguration.empty,
RenderBox? child,
}) : assert(decoration != null),
assert(position != null),
assert(configuration != null),
_decoration = decoration,
}) : _decoration = decoration,
_position = position,
_configuration = configuration,
super(child);
@@ -2290,7 +2249,6 @@ class RenderDecoratedBox extends RenderProxyBox {
Decoration get decoration => _decoration;
Decoration _decoration;
set decoration(Decoration value) {
assert(value != null);
if (value == _decoration) {
return;
}
@@ -2304,7 +2262,6 @@ class RenderDecoratedBox extends RenderProxyBox {
DecorationPosition get position => _position;
DecorationPosition _position;
set position(DecorationPosition value) {
assert(value != null);
if (value == _position) {
return;
}
@@ -2321,7 +2278,6 @@ class RenderDecoratedBox extends RenderProxyBox {
ImageConfiguration get configuration => _configuration;
ImageConfiguration _configuration;
set configuration(ImageConfiguration value) {
assert(value != null);
if (value == _configuration) {
return;
}
@@ -2349,8 +2305,6 @@ class RenderDecoratedBox extends RenderProxyBox {
@override
void paint(PaintingContext context, Offset offset) {
assert(size.width != null);
assert(size.height != null);
_painter ??= _decoration.createBoxPainter(markNeedsPaint);
final ImageConfiguration filledConfiguration = configuration.copyWith(size: size);
if (position == DecorationPosition.background) {
@@ -2409,8 +2363,7 @@ class RenderTransform extends RenderProxyBox {
this.transformHitTests = true,
FilterQuality? filterQuality,
RenderBox? child,
}) : assert(transform != null),
super(child) {
}) : super(child) {
this.transform = transform;
this.alignment = alignment;
this.textDirection = textDirection;
@@ -2490,7 +2443,6 @@ class RenderTransform extends RenderProxyBox {
/// mutations outside of the control of the render object could not reliably
/// be reflected in the rendering.
set transform(Matrix4 value) { // ignore: avoid_setters_without_getters
assert(value != null);
if (_transform == value) {
return;
}
@@ -2677,10 +2629,7 @@ class RenderFittedBox extends RenderProxyBox {
TextDirection? textDirection,
RenderBox? child,
Clip clipBehavior = Clip.none,
}) : assert(fit != null),
assert(alignment != null),
assert(clipBehavior != null),
_fit = fit,
}) : _fit = fit,
_alignment = alignment,
_textDirection = textDirection,
_clipBehavior = clipBehavior,
@@ -2718,7 +2667,6 @@ class RenderFittedBox extends RenderProxyBox {
BoxFit get fit => _fit;
BoxFit _fit;
set fit(BoxFit value) {
assert(value != null);
if (_fit == value) {
return;
}
@@ -2743,7 +2691,6 @@ class RenderFittedBox extends RenderProxyBox {
AlignmentGeometry get alignment => _alignment;
AlignmentGeometry _alignment;
set alignment(AlignmentGeometry value) {
assert(value != null);
if (_alignment == value) {
return;
}
@@ -2844,7 +2791,6 @@ class RenderFittedBox extends RenderProxyBox {
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
@@ -2976,8 +2922,7 @@ class RenderFractionalTranslation extends RenderProxyBox {
required Offset translation,
this.transformHitTests = true,
RenderBox? child,
}) : assert(translation != null),
_translation = translation,
}) : _translation = translation,
super(child);
/// The translation to apply to the child, scaled to the child's size.
@@ -2987,7 +2932,6 @@ class RenderFractionalTranslation extends RenderProxyBox {
Offset get translation => _translation;
Offset _translation;
set translation(Offset value) {
assert(value != null);
if (_translation == value) {
return;
}
@@ -3246,9 +3190,7 @@ class RenderMouseRegion extends RenderProxyBoxWithHitTestBehavior implements Mou
bool opaque = true,
super.child,
HitTestBehavior? hitTestBehavior = HitTestBehavior.opaque,
}) : assert(opaque != null),
assert(cursor != null),
_cursor = cursor,
}) : _cursor = cursor,
_validForMouseTracker = validForMouseTracker,
_opaque = opaque,
super(behavior: hitTestBehavior ?? HitTestBehavior.opaque);
@@ -3649,9 +3591,7 @@ class RenderIgnorePointer extends RenderProxyBox {
bool? ignoringSemantics,
}) : _ignoring = ignoring,
_ignoringSemantics = ignoringSemantics,
super(child) {
assert(_ignoring != null);
}
super(child);
/// Whether this render object is ignored during hit testing.
///
@@ -3660,7 +3600,6 @@ class RenderIgnorePointer extends RenderProxyBox {
bool get ignoring => _ignoring;
bool _ignoring;
set ignoring(bool value) {
assert(value != null);
if (value == _ignoring) {
return;
}
@@ -3727,8 +3666,7 @@ class RenderOffstage extends RenderProxyBox {
RenderOffstage({
bool offstage = true,
RenderBox? child,
}) : assert(offstage != null),
_offstage = offstage,
}) : _offstage = offstage,
super(child);
/// Whether the child is hidden from the rest of the tree.
@@ -3741,7 +3679,6 @@ class RenderOffstage extends RenderProxyBox {
bool get offstage => _offstage;
bool _offstage;
set offstage(bool value) {
assert(value != null);
if (value == _offstage) {
return;
}
@@ -3882,8 +3819,7 @@ class RenderAbsorbPointer extends RenderProxyBox {
RenderBox? child,
bool absorbing = true,
bool? ignoringSemantics,
}) : assert(absorbing != null),
_absorbing = absorbing,
}) : _absorbing = absorbing,
_ignoringSemantics = ignoringSemantics,
super(child);
@@ -3992,8 +3928,7 @@ class RenderSemanticsGestureHandler extends RenderProxyBoxWithHitTestBehavior {
GestureDragUpdateCallback? onVerticalDragUpdate,
this.scrollFactor = 0.8,
super.behavior,
}) : assert(scrollFactor != null),
_onTap = onTap,
}) : _onTap = onTap,
_onLongPress = onLongPress,
_onHorizontalDragUpdate = onHorizontalDragUpdate,
_onVerticalDragUpdate = onVerticalDragUpdate;
@@ -4186,8 +4121,7 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
bool explicitChildNodes = false,
bool excludeSemantics = false,
TextDirection? textDirection,
}) : assert(container != null),
_container = container,
}) : _container = container,
_explicitChildNodes = explicitChildNodes,
_excludeSemantics = excludeSemantics,
_textDirection = textDirection,
@@ -4200,7 +4134,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
SemanticsProperties get properties => _properties;
SemanticsProperties _properties;
set properties(SemanticsProperties value) {
assert(value != null);
if (_properties == value) {
return;
}
@@ -4219,7 +4152,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
bool get container => _container;
bool _container;
set container(bool value) {
assert(value != null);
if (container == value) {
return;
}
@@ -4243,7 +4175,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
bool get explicitChildNodes => _explicitChildNodes;
bool _explicitChildNodes;
set explicitChildNodes(bool value) {
assert(value != null);
if (_explicitChildNodes == value) {
return;
}
@@ -4260,7 +4191,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
bool get excludeSemantics => _excludeSemantics;
bool _excludeSemantics;
set excludeSemantics(bool value) {
assert(value != null);
if (_excludeSemantics == value) {
return;
}
@@ -4623,7 +4553,6 @@ class RenderBlockSemantics extends RenderProxyBox {
bool get blocking => _blocking;
bool _blocking;
set blocking(bool value) {
assert(value != null);
if (value == _blocking) {
return;
}
@@ -4677,15 +4606,12 @@ class RenderExcludeSemantics extends RenderProxyBox {
RenderBox? child,
bool excluding = true,
}) : _excluding = excluding,
super(child) {
assert(_excluding != null);
}
super(child);
/// Whether this render object is excluded from the semantic tree.
bool get excluding => _excluding;
bool _excluding;
set excluding(bool value) {
assert(value != null);
if (value == _excluding) {
return;
}
@@ -4723,8 +4649,7 @@ class RenderIndexedSemantics extends RenderProxyBox {
RenderIndexedSemantics({
RenderBox? child,
required int index,
}) : assert(index != null),
_index = index,
}) : _index = index,
super(child);
/// The index used to annotated child semantics.
@@ -4764,8 +4689,7 @@ class RenderLeaderLayer extends RenderProxyBox {
RenderLeaderLayer({
required LayerLink link,
RenderBox? child,
}) : assert(link != null),
_link = link,
}) : _link = link,
super(child);
/// The link object that connects this [RenderLeaderLayer] with one or more
@@ -4776,7 +4700,6 @@ class RenderLeaderLayer extends RenderProxyBox {
LayerLink get link => _link;
LayerLink _link;
set link(LayerLink value) {
assert(value != null);
if (_link == value) {
return;
}
@@ -4851,10 +4774,7 @@ class RenderFollowerLayer extends RenderProxyBox {
Alignment leaderAnchor = Alignment.topLeft,
Alignment followerAnchor = Alignment.topLeft,
RenderBox? child,
}) : assert(link != null),
assert(showWhenUnlinked != null),
assert(offset != null),
_link = link,
}) : _link = link,
_showWhenUnlinked = showWhenUnlinked,
_offset = offset,
_leaderAnchor = leaderAnchor,
@@ -4866,7 +4786,6 @@ class RenderFollowerLayer extends RenderProxyBox {
LayerLink get link => _link;
LayerLink _link;
set link(LayerLink value) {
assert(value != null);
if (_link == value) {
return;
}
@@ -4886,7 +4805,6 @@ class RenderFollowerLayer extends RenderProxyBox {
bool get showWhenUnlinked => _showWhenUnlinked;
bool _showWhenUnlinked;
set showWhenUnlinked(bool value) {
assert(value != null);
if (_showWhenUnlinked == value) {
return;
}
@@ -4899,7 +4817,6 @@ class RenderFollowerLayer extends RenderProxyBox {
Offset get offset => _offset;
Offset _offset;
set offset(Offset value) {
assert(value != null);
if (_offset == value) {
return;
}
@@ -4924,7 +4841,6 @@ class RenderFollowerLayer extends RenderProxyBox {
Alignment get leaderAnchor => _leaderAnchor;
Alignment _leaderAnchor;
set leaderAnchor(Alignment value) {
assert(value != null);
if (_leaderAnchor == value) {
return;
}
@@ -4941,7 +4857,6 @@ class RenderFollowerLayer extends RenderProxyBox {
Alignment get followerAnchor => _followerAnchor;
Alignment _followerAnchor;
set followerAnchor(Alignment value) {
assert(value != null);
if (_followerAnchor == value) {
return;
}
@@ -5008,7 +4923,6 @@ class RenderFollowerLayer extends RenderProxyBox {
final Offset effectiveLinkedOffset = leaderSize == null
? this.offset
: leaderAnchor.alongSize(leaderSize) - followerAnchor.alongSize(size) + this.offset;
assert(showWhenUnlinked != null);
if (layer == null) {
layer = FollowerLayer(
link: link,
@@ -5075,9 +4989,7 @@ class RenderAnnotatedRegion<T extends Object> extends RenderProxyBox {
required T value,
required bool sized,
RenderBox? child,
}) : assert(value != null),
assert(sized != null),
_value = value,
}) : _value = value,
_sized = sized,
super(child);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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].

View File

@@ -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;
}

View File

@@ -49,8 +49,6 @@ enum GrowthDirection {
/// [AxisDirection] and a [GrowthDirection] and wish to compute the
/// [AxisDirection] in which growth will occur.
AxisDirection applyGrowthDirectionToAxisDirection(AxisDirection axisDirection, GrowthDirection growthDirection) {
assert(axisDirection != null);
assert(growthDirection != null);
switch (growthDirection) {
case GrowthDirection.forward:
return axisDirection;
@@ -69,8 +67,6 @@ AxisDirection applyGrowthDirectionToAxisDirection(AxisDirection axisDirection, G
/// [ScrollDirection] and a [GrowthDirection] and wish to compute the
/// [ScrollDirection] in which growth will occur.
ScrollDirection applyGrowthDirectionToScrollDirection(ScrollDirection scrollDirection, GrowthDirection growthDirection) {
assert(scrollDirection != null);
assert(growthDirection != null);
switch (growthDirection) {
case GrowthDirection.forward:
return scrollDirection;
@@ -103,18 +99,7 @@ class SliverConstraints extends Constraints {
required this.viewportMainAxisExtent,
required this.remainingCacheExtent,
required this.cacheOrigin,
}) : assert(axisDirection != null),
assert(growthDirection != null),
assert(userScrollDirection != null),
assert(scrollOffset != null),
assert(precedingScrollExtent != null),
assert(overlap != null),
assert(remainingPaintExtent != null),
assert(crossAxisExtent != null),
assert(crossAxisDirection != null),
assert(viewportMainAxisExtent != null),
assert(remainingCacheExtent != null),
assert(cacheOrigin != null);
});
/// Creates a copy of this object but with the given fields replaced with the
/// new values.
@@ -341,7 +326,6 @@ class SliverConstraints extends Constraints {
/// This can be useful in combination with [axis] to view the [axisDirection]
/// and [growthDirection] in different terms.
GrowthDirection get normalizedGrowthDirection {
assert(axisDirection != null);
switch (axisDirection) {
case AxisDirection.down:
case AxisDirection.right:
@@ -417,7 +401,6 @@ class SliverConstraints extends Constraints {
errorMessage.writeln(' $message');
}
void verifyDouble(double property, String name, {bool mustBePositive = false, bool mustBeNegative = false}) {
verify(property != null, 'The "$name" is null.');
if (property.isNaN) {
String additional = '.';
if (mustBePositive) {
@@ -432,13 +415,10 @@ class SliverConstraints extends Constraints {
verify(property <= 0.0, 'The "$name" is positive.');
}
}
verify(axis != null, 'The "axis" is null.');
verify(growthDirection != null, 'The "growthDirection" is null.');
verifyDouble(scrollOffset, 'scrollOffset');
verifyDouble(overlap, 'overlap');
verifyDouble(crossAxisExtent, 'crossAxisExtent');
verifyDouble(scrollOffset, 'scrollOffset', mustBePositive: true);
verify(crossAxisDirection != null, 'The "crossAxisDirection" is null.');
verify(axisDirectionToAxis(axisDirection) != axisDirectionToAxis(crossAxisDirection), 'The "axisDirection" and the "crossAxisDirection" are along the same axis.');
verifyDouble(viewportMainAxisExtent, 'viewportMainAxisExtent', mustBePositive: true);
verifyDouble(remainingPaintExtent, 'remainingPaintExtent', mustBePositive: true);
@@ -539,12 +519,7 @@ class SliverGeometry with Diagnosticable {
this.hasVisualOverflow = false,
this.scrollOffsetCorrection,
double? cacheExtent,
}) : assert(scrollExtent != null),
assert(paintExtent != null),
assert(paintOrigin != null),
assert(maxPaintExtent != null),
assert(hasVisualOverflow != null),
assert(scrollOffsetCorrection != 0.0),
}) : assert(scrollOffsetCorrection != 0.0),
layoutExtent = layoutExtent ?? paintExtent,
hitTestExtent = hitTestExtent ?? paintExtent,
cacheExtent = cacheExtent ?? layoutExtent ?? paintExtent,
@@ -717,12 +692,8 @@ class SliverGeometry with Diagnosticable {
]);
}
verify(scrollExtent != null, 'The "scrollExtent" is null.');
verify(scrollExtent >= 0.0, 'The "scrollExtent" is negative.');
verify(paintExtent != null, 'The "paintExtent" is null.');
verify(paintExtent >= 0.0, 'The "paintExtent" is negative.');
verify(paintOrigin != null, 'The "paintOrigin" is null.');
verify(layoutExtent != null, 'The "layoutExtent" is null.');
verify(layoutExtent >= 0.0, 'The "layoutExtent" is negative.');
verify(cacheExtent >= 0.0, 'The "cacheExtent" is negative.');
if (layoutExtent > paintExtent) {
@@ -731,7 +702,6 @@ class SliverGeometry with Diagnosticable {
details: _debugCompareFloats('paintExtent', paintExtent, 'layoutExtent', layoutExtent),
);
}
verify(maxPaintExtent != null, 'The "maxPaintExtent" is null.');
// If the paintExtent is slightly more than the maxPaintExtent, but the difference is still less
// than precisionErrorTolerance, we will not throw the assert below.
if (paintExtent - maxPaintExtent > precisionErrorTolerance) {
@@ -742,10 +712,7 @@ class SliverGeometry with Diagnosticable {
..add(ErrorDescription("By definition, a sliver can't paint more than the maximum that it can paint!")),
);
}
verify(hitTestExtent != null, 'The "hitTestExtent" is null.');
verify(hitTestExtent >= 0.0, 'The "hitTestExtent" is negative.');
verify(visible != null, 'The "visible" property is null.');
verify(hasVisualOverflow != null, 'The "hasVisualOverflow" is null.');
verify(scrollOffsetCorrection != 0.0, 'The "scrollOffsetCorrection" is zero.');
return true;
}());
@@ -847,11 +814,6 @@ class SliverHitTestResult extends HitTestResult {
required double crossAxisPosition,
required SliverHitTest hitTest,
}) {
assert(mainAxisOffset != null);
assert(crossAxisOffset != null);
assert(mainAxisPosition != null);
assert(crossAxisPosition != null);
assert(hitTest != null);
if (paintOffset != null) {
pushOffset(-paintOffset);
}
@@ -879,8 +841,7 @@ class SliverHitTestEntry extends HitTestEntry<RenderSliver> {
super.target, {
required this.mainAxisPosition,
required this.crossAxisPosition,
}) : assert(mainAxisPosition != null),
assert(crossAxisPosition != null);
});
/// The distance in the [AxisDirection] from the edge of the sliver's painted
/// area (as given by the [SliverConstraints.scrollOffset]) to the hit point.
@@ -1180,7 +1141,6 @@ abstract class RenderSliver extends RenderObject {
@override
Rect get paintBounds {
assert(constraints.axis != null);
switch (constraints.axis) {
case Axis.horizontal:
return Rect.fromLTWH(
@@ -1599,8 +1559,6 @@ abstract class RenderSliver extends RenderObject {
/// Mixin for [RenderSliver] subclasses that provides some utility functions.
mixin RenderSliverHelpers implements RenderSliver {
bool _getRightWayUp(SliverConstraints constraints) {
assert(constraints != null);
assert(constraints.axisDirection != null);
bool rightWayUp;
switch (constraints.axisDirection) {
case AxisDirection.up:
@@ -1612,7 +1570,6 @@ mixin RenderSliverHelpers implements RenderSliver {
rightWayUp = true;
break;
}
assert(constraints.growthDirection != null);
switch (constraints.growthDirection) {
case GrowthDirection.forward:
break;
@@ -1620,7 +1577,6 @@ mixin RenderSliverHelpers implements RenderSliver {
rightWayUp = !rightWayUp;
break;
}
assert(rightWayUp != null);
return rightWayUp;
}
@@ -1642,7 +1598,6 @@ mixin RenderSliverHelpers implements RenderSliver {
double absolutePosition = mainAxisPosition - delta;
final double absoluteCrossAxisPosition = crossAxisPosition - crossAxisDelta;
Offset paintOffset, transformedPosition;
assert(constraints.axis != null);
switch (constraints.axis) {
case Axis.horizontal:
if (!rightWayUp) {
@@ -1661,8 +1616,6 @@ mixin RenderSliverHelpers implements RenderSliver {
transformedPosition = Offset(absoluteCrossAxisPosition, absolutePosition);
break;
}
assert(paintOffset != null);
assert(transformedPosition != null);
return result.addWithOutOfBandPosition(
paintOffset: paintOffset,
hitTest: (BoxHitTestResult result) {
@@ -1684,7 +1637,6 @@ mixin RenderSliverHelpers implements RenderSliver {
final bool rightWayUp = _getRightWayUp(constraints);
double delta = childMainAxisPosition(child);
final double crossAxisDelta = childCrossAxisPosition(child);
assert(constraints.axis != null);
switch (constraints.axis) {
case Axis.horizontal:
if (!rightWayUp) {
@@ -1736,8 +1688,6 @@ abstract class RenderSliverSingleBoxAdapter extends RenderSliver with RenderObje
@protected
void setChildParentData(RenderObject child, SliverConstraints constraints, SliverGeometry geometry) {
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(0.0, -(geometry.scrollExtent - (geometry.paintExtent + constraints.scrollOffset)));
@@ -1752,7 +1702,6 @@ abstract class RenderSliverSingleBoxAdapter extends RenderSliver with RenderObje
childParentData.paintOffset = Offset(-(geometry.scrollExtent - (geometry.paintExtent + constraints.scrollOffset)), 0.0);
break;
}
assert(childParentData.paintOffset != null);
}
@override
@@ -1771,7 +1720,6 @@ abstract class RenderSliverSingleBoxAdapter extends RenderSliver with RenderObje
@override
void applyPaintTransform(RenderObject child, Matrix4 transform) {
assert(child != null);
assert(child == this.child);
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
childParentData.applyPaintTransform(transform);
@@ -1821,7 +1769,6 @@ class RenderSliverToBoxAdapter extends RenderSliverSingleBoxAdapter {
childExtent = child!.size.height;
break;
}
assert(childExtent != null);
final double paintedChildSize = calculatePaintOffset(constraints, from: 0.0, to: childExtent);
final double cacheExtent = calculateCacheOffset(constraints, from: 0.0, to: childExtent);

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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.',

View File

@@ -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(

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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;

View File

@@ -136,8 +136,7 @@ class RevealedOffset {
const RevealedOffset({
required this.offset,
required this.rect,
}) : assert(offset != null),
assert(rect != null);
});
/// Offset for the viewport to reveal a specific element in the viewport.
///
@@ -213,13 +212,8 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
double? cacheExtent,
CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel,
Clip clipBehavior = Clip.hardEdge,
}) : assert(axisDirection != null),
assert(crossAxisDirection != null),
assert(offset != null),
assert(axisDirectionToAxis(axisDirection) != axisDirectionToAxis(crossAxisDirection)),
assert(cacheExtentStyle != null),
}) : assert(axisDirectionToAxis(axisDirection) != axisDirectionToAxis(crossAxisDirection)),
assert(cacheExtent != null || cacheExtentStyle == CacheExtentStyle.pixel),
assert(clipBehavior != null),
_axisDirection = axisDirection,
_crossAxisDirection = crossAxisDirection,
_offset = offset,
@@ -264,7 +258,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
AxisDirection get axisDirection => _axisDirection;
AxisDirection _axisDirection;
set axisDirection(AxisDirection value) {
assert(value != null);
if (value == _axisDirection) {
return;
}
@@ -281,7 +274,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
AxisDirection get crossAxisDirection => _crossAxisDirection;
AxisDirection _crossAxisDirection;
set crossAxisDirection(AxisDirection value) {
assert(value != null);
if (value == _crossAxisDirection) {
return;
}
@@ -304,7 +296,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
ViewportOffset get offset => _offset;
ViewportOffset _offset;
set offset(ViewportOffset value) {
assert(value != null);
if (value == _offset) {
return;
}
@@ -357,7 +348,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
double _cacheExtent;
set cacheExtent(double? value) {
value ??= RenderAbstractViewport.defaultCacheExtent;
assert(value != null);
if (value == _cacheExtent) {
return;
}
@@ -390,7 +380,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
CacheExtentStyle get cacheExtentStyle => _cacheExtentStyle;
CacheExtentStyle _cacheExtentStyle;
set cacheExtentStyle(CacheExtentStyle value) {
assert(value != null);
if (value == _cacheExtentStyle) {
return;
}
@@ -404,7 +393,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
@@ -530,7 +518,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
final double initialLayoutOffset = layoutOffset;
final ScrollDirection adjustedUserScrollDirection =
applyGrowthDirectionToScrollDirection(offset.userScrollDirection, growthDirection);
assert(adjustedUserScrollDirection != null);
double maxPaintOffset = layoutOffset + overlap;
double precedingScrollExtent = 0.0;
@@ -653,7 +640,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
@override
Rect describeSemanticsClip(RenderSliver? child) {
assert(axis != null);
if (_calculatedCacheExtent == null) {
return semanticBounds;
@@ -733,7 +719,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
size = Size(child.geometry!.layoutExtent, child.constraints.crossAxisExtent);
break;
}
assert(size != null);
canvas.drawRect(((offset + paintOffsetOf(child)) & size).deflate(0.5), paint);
child = childAfter(child);
}
@@ -754,8 +739,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
crossAxisPosition = position.dy;
break;
}
assert(mainAxisPosition != null);
assert(crossAxisPosition != null);
final SliverHitTestResult sliverResult = SliverHitTestResult.wrap(result);
for (final RenderSliver child in childrenInHitTestOrder) {
if (!child.geometry!.visible) {
@@ -808,7 +791,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
bool onlySlivers = target is RenderSliver; // ... between viewport and `target` (`target` included).
while (child.parent != this) {
final RenderObject parent = child.parent! as RenderObject;
assert(parent != null, '$target must be a descendant of $this');
if (child is RenderBox) {
pivot = child;
}
@@ -878,10 +860,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
return RevealedOffset(offset: offset.pixels, rect: rect!);
}
assert(pivotExtent != null);
assert(rect != null);
assert(rectLocal != null);
assert(growthDirection != null);
assert(child.parent == this);
assert(child is RenderSliver);
final RenderSliver sliver = child as RenderSliver;
@@ -994,9 +972,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
@protected
Offset computeAbsolutePaintOffset(RenderSliver child, double layoutOffset, GrowthDirection growthDirection) {
assert(hasSize); // this is only usable once we have a size
assert(axisDirection != null);
assert(growthDirection != null);
assert(child != null);
assert(child.geometry != null);
switch (applyGrowthDirectionToAxisDirection(axisDirection, growthDirection)) {
case AxisDirection.up:
@@ -1213,8 +1188,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
Duration duration = Duration.zero,
Curve curve = Curves.ease,
}) {
assert(viewport != null);
assert(offset != null);
if (descendant == null) {
return rect;
}
@@ -1265,7 +1238,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
return MatrixUtils.transformRect(transform, rect ?? descendant.paintBounds);
}
assert(targetOffset != null);
offset.moveTo(targetOffset.offset, duration: duration, curve: curve);
return targetOffset.rect;
@@ -1321,10 +1293,8 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
super.cacheExtent,
super.cacheExtentStyle,
super.clipBehavior,
}) : assert(anchor != null),
assert(anchor >= 0.0 && anchor <= 1.0),
}) : assert(anchor >= 0.0 && anchor <= 1.0),
assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null),
assert(clipBehavior != null),
_anchor = anchor,
_center = center {
addAll(children);
@@ -1385,7 +1355,6 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
double get anchor => _anchor;
double _anchor;
set anchor(double value) {
assert(value != null);
assert(value >= 0.0 && value <= 1.0);
if (value == _anchor) {
return;
@@ -1537,7 +1506,6 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
double correction;
int count = 0;
do {
assert(offset.pixels != null);
correction = _attemptLayout(mainAxisExtent, crossAxisExtent, offset.pixels + centerOffsetAdjustment);
if (correction != 0.0) {
offset.correctBy(correction);
@@ -1680,7 +1648,6 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
double scrollOffsetOf(RenderSliver child, double scrollOffsetWithinChild) {
assert(child.parent == this);
final GrowthDirection growthDirection = child.constraints.growthDirection;
assert(growthDirection != null);
switch (growthDirection) {
case GrowthDirection.forward:
double scrollOffsetToChild = 0.0;
@@ -1705,7 +1672,6 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
double maxScrollObstructionExtentBefore(RenderSliver child) {
assert(child.parent == this);
final GrowthDirection growthDirection = child.constraints.growthDirection;
assert(growthDirection != null);
switch (growthDirection) {
case GrowthDirection.forward:
double pinnedExtent = 0.0;
@@ -1729,15 +1695,12 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
@override
void applyPaintTransform(RenderObject child, Matrix4 transform) {
// Hit test logic relies on this always providing an invertible matrix.
assert(child != null);
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
childParentData.applyPaintTransform(transform);
}
@override
double computeChildMainAxisPosition(RenderSliver child, double parentMainAxisPosition) {
assert(child != null);
assert(child.constraints != null);
final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
switch (applyGrowthDirectionToAxisDirection(child.constraints.axisDirection, child.constraints.growthDirection)) {
case AxisDirection.down:
@@ -1935,7 +1898,6 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
double correction;
double effectiveExtent;
do {
assert(offset.pixels != null);
correction = _attemptLayout(mainAxisExtent, crossAxisExtent, offset.pixels);
if (correction != 0.0) {
offset.correctBy(correction);
@@ -2061,15 +2023,12 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
@override
void applyPaintTransform(RenderObject child, Matrix4 transform) {
// Hit test logic relies on this always providing an invertible matrix.
assert(child != null);
final Offset offset = paintOffsetOf(child as RenderSliver);
transform.translate(offset.dx, offset.dy);
}
@override
double computeChildMainAxisPosition(RenderSliver child, double parentMainAxisPosition) {
assert(child != null);
assert(child.constraints != null);
assert(hasSize);
final SliverLogicalParentData childParentData = child.parentData! as SliverLogicalParentData;
switch (applyGrowthDirectionToAxisDirection(child.constraints.axisDirection, child.constraints.growthDirection)) {

View File

@@ -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();

View File

@@ -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>[];