Commit abb76697 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

apply prefer_asserts_in_initializer_list lint (#10489)

parent c55097da
...@@ -39,10 +39,11 @@ class RenderAnimatedSize extends RenderAligningShiftedBox { ...@@ -39,10 +39,11 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
Curve curve: Curves.linear, Curve curve: Curves.linear,
FractionalOffset alignment: FractionalOffset.center, FractionalOffset alignment: FractionalOffset.center,
RenderBox child, RenderBox child,
}) : _vsync = vsync, super(child: child, alignment: alignment) { }) : assert(vsync != null),
assert(vsync != null); assert(duration != null),
assert(duration != null); assert(curve != null),
assert(curve != null); _vsync = vsync,
super(child: child, alignment: alignment) {
_controller = new AnimationController( _controller = new AnimationController(
vsync: vsync, vsync: vsync,
duration: duration, duration: duration,
......
...@@ -268,8 +268,8 @@ class RenderCustomMultiChildLayoutBox extends RenderBox ...@@ -268,8 +268,8 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
RenderCustomMultiChildLayoutBox({ RenderCustomMultiChildLayoutBox({
List<RenderBox> children, List<RenderBox> children,
@required MultiChildLayoutDelegate delegate @required MultiChildLayoutDelegate delegate
}) : _delegate = delegate { }) : assert(delegate != null),
assert(delegate != null); _delegate = delegate {
addAll(children); addAll(children);
} }
......
...@@ -71,16 +71,16 @@ class RenderEditable extends RenderBox { ...@@ -71,16 +71,16 @@ class RenderEditable extends RenderBox {
@required ViewportOffset offset, @required ViewportOffset offset,
this.onSelectionChanged, this.onSelectionChanged,
this.onCaretChanged, this.onCaretChanged,
}) : _textPainter = new TextPainter(text: text, textAlign: textAlign, textScaleFactor: textScaleFactor), }) : assert(maxLines != null),
assert(textScaleFactor != null),
assert(offset != null),
_textPainter = new TextPainter(text: text, textAlign: textAlign, textScaleFactor: textScaleFactor),
_cursorColor = cursorColor, _cursorColor = cursorColor,
_showCursor = showCursor ?? new ValueNotifier<bool>(false), _showCursor = showCursor ?? new ValueNotifier<bool>(false),
_maxLines = maxLines, _maxLines = maxLines,
_selection = selection, _selection = selection,
_offset = offset { _offset = offset {
assert(_showCursor != null); assert(_showCursor != null);
assert(maxLines != null);
assert(textScaleFactor != null);
assert(offset != null);
assert(!_showCursor.value || cursorColor != null); assert(!_showCursor.value || cursorColor != null);
_tap = new TapGestureRecognizer() _tap = new TapGestureRecognizer()
..onTapDown = _handleTapDown ..onTapDown = _handleTapDown
......
...@@ -201,15 +201,15 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -201,15 +201,15 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start, MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center, CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
TextBaseline textBaseline TextBaseline textBaseline
}) : _direction = direction, }) : assert(direction != null),
assert(mainAxisAlignment != null),
assert(mainAxisSize != null),
assert(crossAxisAlignment != null),
_direction = direction,
_mainAxisAlignment = mainAxisAlignment, _mainAxisAlignment = mainAxisAlignment,
_mainAxisSize = mainAxisSize, _mainAxisSize = mainAxisSize,
_crossAxisAlignment = crossAxisAlignment, _crossAxisAlignment = crossAxisAlignment,
_textBaseline = textBaseline { _textBaseline = textBaseline {
assert(direction != null);
assert(mainAxisAlignment != null);
assert(mainAxisSize != null);
assert(crossAxisAlignment != null);
addAll(children); addAll(children);
} }
......
...@@ -182,8 +182,8 @@ class RenderFlow extends RenderBox ...@@ -182,8 +182,8 @@ class RenderFlow extends RenderBox
RenderFlow({ RenderFlow({
List<RenderBox> children, List<RenderBox> children,
@required FlowDelegate delegate @required FlowDelegate delegate
}) : _delegate = delegate { }) : assert(delegate != null),
assert(delegate != null); _delegate = delegate {
addAll(children); addAll(children);
} }
......
...@@ -643,11 +643,9 @@ class PhysicalModelLayer extends ContainerLayer { ...@@ -643,11 +643,9 @@ class PhysicalModelLayer extends ContainerLayer {
@required this.clipRRect, @required this.clipRRect,
@required this.elevation, @required this.elevation,
@required this.color, @required this.color,
}) { }) : assert(clipRRect != null),
assert(clipRRect != null); assert(elevation != null),
assert(elevation != null); assert(color != null);
assert(color != null);
}
/// The rounded-rect to clip in the parent's coordinate system. /// The rounded-rect to clip in the parent's coordinate system.
/// ///
......
...@@ -57,10 +57,9 @@ typedef void PaintingContextCallback(PaintingContext context, Offset offset); ...@@ -57,10 +57,9 @@ typedef void PaintingContextCallback(PaintingContext context, Offset offset);
/// not hold a reference to the canvas across operations that might paint /// not hold a reference to the canvas across operations that might paint
/// child render objects. /// child render objects.
class PaintingContext { class PaintingContext {
PaintingContext._(this._containerLayer, this._paintBounds) { PaintingContext._(this._containerLayer, this._paintBounds)
assert(_containerLayer != null); : assert(_containerLayer != null),
assert(_paintBounds != null); assert(_paintBounds != null);
}
final ContainerLayer _containerLayer; final ContainerLayer _containerLayer;
final Rect _paintBounds; final Rect _paintBounds;
...@@ -664,19 +663,17 @@ abstract class _SemanticsFragment { ...@@ -664,19 +663,17 @@ abstract class _SemanticsFragment {
this.annotator, this.annotator,
List<_SemanticsFragment> children, List<_SemanticsFragment> children,
this.dropSemanticsOfPreviousSiblings, this.dropSemanticsOfPreviousSiblings,
}) { }) : assert(renderObjectOwner != null),
assert(renderObjectOwner != null); assert(() {
_ancestorChain = <RenderObject>[renderObjectOwner]; if (children == null)
assert(() { return true;
if (children == null) final Set<_SemanticsFragment> seenChildren = new Set<_SemanticsFragment>();
return true; for (_SemanticsFragment child in children)
final Set<_SemanticsFragment> seenChildren = new Set<_SemanticsFragment>(); assert(seenChildren.add(child)); // check for duplicate adds
for (_SemanticsFragment child in children) return true;
assert(seenChildren.add(child)); // check for duplicate adds }),
return true; _ancestorChain = <RenderObject>[renderObjectOwner],
}); _children = children ?? const <_SemanticsFragment>[];
_children = children ?? const <_SemanticsFragment>[];
}
final SemanticsAnnotator annotator; final SemanticsAnnotator annotator;
bool dropSemanticsOfPreviousSiblings; bool dropSemanticsOfPreviousSiblings;
...@@ -722,10 +719,12 @@ class _CleanSemanticsFragment extends _SemanticsFragment { ...@@ -722,10 +719,12 @@ class _CleanSemanticsFragment extends _SemanticsFragment {
_CleanSemanticsFragment({ _CleanSemanticsFragment({
@required RenderObject renderObjectOwner, @required RenderObject renderObjectOwner,
bool dropSemanticsOfPreviousSiblings, bool dropSemanticsOfPreviousSiblings,
}) : super(renderObjectOwner: renderObjectOwner, dropSemanticsOfPreviousSiblings: dropSemanticsOfPreviousSiblings) { }) : assert(renderObjectOwner != null),
assert(renderObjectOwner != null); assert(renderObjectOwner._semantics != null),
assert(renderObjectOwner._semantics != null); super(
} renderObjectOwner: renderObjectOwner,
dropSemanticsOfPreviousSiblings: dropSemanticsOfPreviousSiblings
);
@override @override
Iterable<SemanticsNode> compile({ _SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics }) sync* { Iterable<SemanticsNode> compile({ _SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics }) sync* {
...@@ -903,10 +902,13 @@ class _ForkingSemanticsFragment extends _SemanticsFragment { ...@@ -903,10 +902,13 @@ class _ForkingSemanticsFragment extends _SemanticsFragment {
RenderObject renderObjectOwner, RenderObject renderObjectOwner,
@required Iterable<_SemanticsFragment> children, @required Iterable<_SemanticsFragment> children,
bool dropSemanticsOfPreviousSiblings, bool dropSemanticsOfPreviousSiblings,
}) : super(renderObjectOwner: renderObjectOwner, children: children, dropSemanticsOfPreviousSiblings: dropSemanticsOfPreviousSiblings) { }) : assert(children != null),
assert(children != null); assert(children.length > 1),
assert(children.length > 1); super(
} renderObjectOwner: renderObjectOwner,
children: children,
dropSemanticsOfPreviousSiblings: dropSemanticsOfPreviousSiblings
);
@override @override
Iterable<SemanticsNode> compile({ Iterable<SemanticsNode> compile({
...@@ -946,8 +948,8 @@ class _ForkingSemanticsFragment extends _SemanticsFragment { ...@@ -946,8 +948,8 @@ class _ForkingSemanticsFragment extends _SemanticsFragment {
/// [PipelineOwner] for the render tree from which you wish to read semantics. /// [PipelineOwner] for the render tree from which you wish to read semantics.
/// You can obtain the [PipelineOwner] using the [RenderObject.owner] property. /// You can obtain the [PipelineOwner] using the [RenderObject.owner] property.
class SemanticsHandle { class SemanticsHandle {
SemanticsHandle._(this._owner, this.listener) { SemanticsHandle._(this._owner, this.listener)
assert(_owner != null); : assert(_owner != null) {
if (listener != null) if (listener != null)
_owner.semanticsOwner.addListener(listener); _owner.semanticsOwner.addListener(listener);
} }
......
...@@ -38,7 +38,12 @@ class RenderParagraph extends RenderBox { ...@@ -38,7 +38,12 @@ class RenderParagraph extends RenderBox {
TextOverflow overflow: TextOverflow.clip, TextOverflow overflow: TextOverflow.clip,
double textScaleFactor: 1.0, double textScaleFactor: 1.0,
int maxLines, int maxLines,
}) : _softWrap = softWrap, }) : assert(text != null),
assert(text.debugAssertIsValid()),
assert(softWrap != null),
assert(overflow != null),
assert(textScaleFactor != null),
_softWrap = softWrap,
_overflow = overflow, _overflow = overflow,
_textPainter = new TextPainter( _textPainter = new TextPainter(
text: text, text: text,
...@@ -46,13 +51,7 @@ class RenderParagraph extends RenderBox { ...@@ -46,13 +51,7 @@ class RenderParagraph extends RenderBox {
textScaleFactor: textScaleFactor, textScaleFactor: textScaleFactor,
maxLines: maxLines, maxLines: maxLines,
ellipsis: overflow == TextOverflow.ellipsis ? _kEllipsis : null, ellipsis: overflow == TextOverflow.ellipsis ? _kEllipsis : null,
) { );
assert(text != null);
assert(text.debugAssertIsValid());
assert(softWrap != null);
assert(overflow != null);
assert(textScaleFactor != null);
}
final TextPainter _textPainter; final TextPainter _textPainter;
......
...@@ -66,15 +66,14 @@ class RenderPerformanceOverlay extends RenderBox { ...@@ -66,15 +66,14 @@ class RenderPerformanceOverlay extends RenderBox {
int rasterizerThreshold: 0, int rasterizerThreshold: 0,
bool checkerboardRasterCacheImages: false, bool checkerboardRasterCacheImages: false,
bool checkerboardOffscreenLayers: false, bool checkerboardOffscreenLayers: false,
}) : _optionsMask = optionsMask, }) : assert(optionsMask != null),
_rasterizerThreshold = rasterizerThreshold, assert(rasterizerThreshold != null),
_checkerboardRasterCacheImages = checkerboardRasterCacheImages, assert(checkerboardRasterCacheImages != null),
_checkerboardOffscreenLayers = checkerboardOffscreenLayers { assert(checkerboardOffscreenLayers != null),
assert(optionsMask != null); _optionsMask = optionsMask,
assert(rasterizerThreshold != null); _rasterizerThreshold = rasterizerThreshold,
assert(checkerboardRasterCacheImages != null); _checkerboardRasterCacheImages = checkerboardRasterCacheImages,
assert(checkerboardOffscreenLayers != null); _checkerboardOffscreenLayers = checkerboardOffscreenLayers;
}
/// The mask is created by shifting 1 by the index of the specific /// The mask is created by shifting 1 by the index of the specific
/// [PerformanceOverlayOption] to enable. /// [PerformanceOverlayOption] to enable.
......
...@@ -201,10 +201,10 @@ class RenderConstrainedBox extends RenderProxyBox { ...@@ -201,10 +201,10 @@ class RenderConstrainedBox extends RenderProxyBox {
RenderConstrainedBox({ RenderConstrainedBox({
RenderBox child, RenderBox child,
@required BoxConstraints additionalConstraints, @required BoxConstraints additionalConstraints,
}) : _additionalConstraints = additionalConstraints, super(child) { }) : assert(additionalConstraints != null),
assert(additionalConstraints != null); assert(additionalConstraints.debugAssertIsValid()),
assert(additionalConstraints.debugAssertIsValid()); _additionalConstraints = additionalConstraints,
} super(child);
/// Additional constraints to apply to [child] during layout /// Additional constraints to apply to [child] during layout
BoxConstraints get additionalConstraints => _additionalConstraints; BoxConstraints get additionalConstraints => _additionalConstraints;
...@@ -311,10 +311,11 @@ class RenderLimitedBox extends RenderProxyBox { ...@@ -311,10 +311,11 @@ class RenderLimitedBox extends RenderProxyBox {
RenderBox child, RenderBox child,
double maxWidth: double.INFINITY, double maxWidth: double.INFINITY,
double maxHeight: double.INFINITY double maxHeight: double.INFINITY
}) : _maxWidth = maxWidth, _maxHeight = maxHeight, super(child) { }) : assert(maxWidth != null && maxWidth >= 0.0),
assert(maxWidth != null && maxWidth >= 0.0); assert(maxHeight != null && maxHeight >= 0.0),
assert(maxHeight != null && maxHeight >= 0.0); _maxWidth = maxWidth,
} _maxHeight = maxHeight,
super(child);
/// The value to use for maxWidth if the incoming maxWidth constraint is infinite. /// The value to use for maxWidth if the incoming maxWidth constraint is infinite.
double get maxWidth => _maxWidth; double get maxWidth => _maxWidth;
...@@ -400,11 +401,11 @@ class RenderAspectRatio extends RenderProxyBox { ...@@ -400,11 +401,11 @@ class RenderAspectRatio extends RenderProxyBox {
RenderAspectRatio({ RenderAspectRatio({
RenderBox child, RenderBox child,
@required double aspectRatio, @required double aspectRatio,
}) : _aspectRatio = aspectRatio, super(child) { }) : assert(aspectRatio != null),
assert(aspectRatio != null); assert(aspectRatio > 0.0),
assert(aspectRatio > 0.0); assert(aspectRatio.isFinite),
assert(aspectRatio.isFinite); _aspectRatio = aspectRatio,
} super(child);
/// The aspect ratio to attempt to use. /// The aspect ratio to attempt to use.
/// ///
...@@ -714,10 +715,11 @@ class RenderOpacity extends RenderProxyBox { ...@@ -714,10 +715,11 @@ class RenderOpacity extends RenderProxyBox {
/// ///
/// The [opacity] argument must be between 0.0 and 1.0, inclusive. /// The [opacity] argument must be between 0.0 and 1.0, inclusive.
RenderOpacity({ double opacity: 1.0, RenderBox child }) RenderOpacity({ double opacity: 1.0, RenderBox child })
: _opacity = opacity, _alpha = _getAlphaFromOpacity(opacity), super(child) { : assert(opacity != null),
assert(opacity != null); assert(opacity >= 0.0 && opacity <= 1.0),
assert(opacity >= 0.0 && opacity <= 1.0); _opacity = opacity,
} _alpha = _getAlphaFromOpacity(opacity),
super(child);
@override @override
bool get alwaysNeedsCompositing => child != null && (_alpha != 0 && _alpha != 255); bool get alwaysNeedsCompositing => child != null && (_alpha != 0 && _alpha != 255);
...@@ -792,10 +794,11 @@ class RenderShaderMask extends RenderProxyBox { ...@@ -792,10 +794,11 @@ class RenderShaderMask extends RenderProxyBox {
RenderBox child, RenderBox child,
@required ShaderCallback shaderCallback, @required ShaderCallback shaderCallback,
BlendMode blendMode: BlendMode.modulate, BlendMode blendMode: BlendMode.modulate,
}) : _shaderCallback = shaderCallback, _blendMode = blendMode, super(child) { }) : assert(shaderCallback != null),
assert(shaderCallback != null); assert(blendMode != null),
assert(blendMode != null); _shaderCallback = shaderCallback,
} _blendMode = blendMode,
super(child);
/// Called to creates the [Shader] that generates the mask. /// Called to creates the [Shader] that generates the mask.
/// ///
...@@ -849,9 +852,9 @@ class RenderBackdropFilter extends RenderProxyBox { ...@@ -849,9 +852,9 @@ class RenderBackdropFilter extends RenderProxyBox {
/// ///
/// The [filter] argument must not be null. /// The [filter] argument must not be null.
RenderBackdropFilter({ RenderBox child, @required ui.ImageFilter filter }) RenderBackdropFilter({ RenderBox child, @required ui.ImageFilter filter })
: _filter = filter, super(child) { : assert(filter != null),
assert(filter != null); _filter = filter,
} super(child);
/// The image filter to apply to the existing painted content before painting /// The image filter to apply to the existing painted content before painting
/// the child. /// the child.
...@@ -1221,15 +1224,14 @@ class RenderPhysicalModel extends _RenderCustomClip<RRect> { ...@@ -1221,15 +1224,14 @@ class RenderPhysicalModel extends _RenderCustomClip<RRect> {
BorderRadius borderRadius, BorderRadius borderRadius,
double elevation: 0.0, double elevation: 0.0,
@required Color color, @required Color color,
}) : _shape = shape, }) : assert(shape != null),
assert(elevation != null),
assert(color != null),
_shape = shape,
_borderRadius = borderRadius, _borderRadius = borderRadius,
_elevation = elevation, _elevation = elevation,
_color = color, _color = color,
super(child: child) { super(child: child);
assert(shape != null);
assert(elevation != null);
assert(color != null);
}
/// The shape of the layer. /// The shape of the layer.
/// ///
...@@ -1347,14 +1349,13 @@ class RenderDecoratedBox extends RenderProxyBox { ...@@ -1347,14 +1349,13 @@ class RenderDecoratedBox extends RenderProxyBox {
DecorationPosition position: DecorationPosition.background, DecorationPosition position: DecorationPosition.background,
ImageConfiguration configuration: ImageConfiguration.empty, ImageConfiguration configuration: ImageConfiguration.empty,
RenderBox child RenderBox child
}) : _decoration = decoration, }) : assert(decoration != null),
assert(position != null),
assert(configuration != null),
_decoration = decoration,
_position = position, _position = position,
_configuration = configuration, _configuration = configuration,
super(child) { super(child);
assert(decoration != null);
assert(position != null);
assert(configuration != null);
}
BoxPainter _painter; BoxPainter _painter;
...@@ -1468,9 +1469,9 @@ class RenderTransform extends RenderProxyBox { ...@@ -1468,9 +1469,9 @@ class RenderTransform extends RenderProxyBox {
FractionalOffset alignment, FractionalOffset alignment,
this.transformHitTests: true, this.transformHitTests: true,
RenderBox child RenderBox child
}) : super(child) { }) : assert(transform != null),
assert(transform != null); assert(alignment == null || (alignment.dx != null && alignment.dy != null)),
assert(alignment == null || (alignment.dx != null && alignment.dy != null)); super(child) {
this.transform = transform; this.transform = transform;
this.alignment = alignment; this.alignment = alignment;
this.origin = origin; this.origin = origin;
...@@ -1633,10 +1634,11 @@ class RenderFittedBox extends RenderProxyBox { ...@@ -1633,10 +1634,11 @@ class RenderFittedBox extends RenderProxyBox {
RenderBox child, RenderBox child,
BoxFit fit: BoxFit.contain, BoxFit fit: BoxFit.contain,
FractionalOffset alignment: FractionalOffset.center FractionalOffset alignment: FractionalOffset.center
}) : _fit = fit, _alignment = alignment, super(child) { }) : assert(fit != null),
assert(fit != null); assert(alignment != null && alignment.dx != null && alignment.dy != null),
assert(alignment != null && alignment.dx != null && alignment.dy != null); _fit = fit,
} _alignment = alignment,
super(child);
/// How to inscribe the child into the space allocated during layout. /// How to inscribe the child into the space allocated during layout.
BoxFit get fit => _fit; BoxFit get fit => _fit;
...@@ -1771,9 +1773,9 @@ class RenderFractionalTranslation extends RenderProxyBox { ...@@ -1771,9 +1773,9 @@ class RenderFractionalTranslation extends RenderProxyBox {
FractionalOffset translation, FractionalOffset translation,
this.transformHitTests: true, this.transformHitTests: true,
RenderBox child RenderBox child
}) : _translation = translation, super(child) { }) : assert(translation == null || (translation.dx != null && translation.dy != null)),
assert(translation == null || (translation.dx != null && translation.dy != null)); _translation = translation,
} super(child);
/// The translation to apply to the child, as a multiple of the size. /// The translation to apply to the child, as a multiple of the size.
FractionalOffset get translation => _translation; FractionalOffset get translation => _translation;
...@@ -2020,12 +2022,11 @@ class RenderCustomPaint extends RenderProxyBox { ...@@ -2020,12 +2022,11 @@ class RenderCustomPaint extends RenderProxyBox {
CustomPainter foregroundPainter, CustomPainter foregroundPainter,
Size preferredSize: Size.zero, Size preferredSize: Size.zero,
RenderBox child, RenderBox child,
}) : _painter = painter, }) : assert(preferredSize != null),
_painter = painter,
_foregroundPainter = foregroundPainter, _foregroundPainter = foregroundPainter,
_preferredSize = preferredSize, _preferredSize = preferredSize,
super(child) { super(child);
assert(preferredSize != null);
}
/// The background custom paint delegate. /// The background custom paint delegate.
/// ///
...@@ -2490,9 +2491,9 @@ class RenderOffstage extends RenderProxyBox { ...@@ -2490,9 +2491,9 @@ class RenderOffstage extends RenderProxyBox {
RenderOffstage({ RenderOffstage({
bool offstage: true, bool offstage: true,
RenderBox child RenderBox child
}) : _offstage = offstage, super(child) { }) : assert(offstage != null),
assert(offstage != null); _offstage = offstage,
} super(child);
/// Whether the child is hidden from the rest of the tree. /// Whether the child is hidden from the rest of the tree.
/// ///
...@@ -2609,9 +2610,8 @@ class RenderAbsorbPointer extends RenderProxyBox { ...@@ -2609,9 +2610,8 @@ class RenderAbsorbPointer extends RenderProxyBox {
RenderAbsorbPointer({ RenderAbsorbPointer({
RenderBox child, RenderBox child,
this.absorbing: true this.absorbing: true
}) : super(child) { }) : assert(absorbing != null),
assert(absorbing != null); super(child);
}
/// Whether this render object absorbs pointers during hit testing. /// Whether this render object absorbs pointers during hit testing.
/// ///
...@@ -2824,12 +2824,11 @@ class RenderSemanticsAnnotations extends RenderProxyBox { ...@@ -2824,12 +2824,11 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
bool container: false, bool container: false,
bool checked, bool checked,
String label String label
}) : _container = container, }) : assert(container != null),
_container = container,
_checked = checked, _checked = checked,
_label = label, _label = label,
super(child) { super(child);
assert(container != null);
}
/// If 'container' is true, this RenderObject will introduce a new /// If 'container' is true, this RenderObject will introduce a new
/// node in the semantics tree. Otherwise, the semantics will be /// node in the semantics tree. Otherwise, the semantics will be
......
...@@ -26,8 +26,8 @@ class RenderRotatedBox extends RenderBox with RenderObjectWithChildMixin<RenderB ...@@ -26,8 +26,8 @@ class RenderRotatedBox extends RenderBox with RenderObjectWithChildMixin<RenderB
RenderRotatedBox({ RenderRotatedBox({
@required int quarterTurns, @required int quarterTurns,
RenderBox child RenderBox child
}) : _quarterTurns = quarterTurns { }) : assert(quarterTurns != null),
assert(quarterTurns != null); _quarterTurns = quarterTurns {
this.child = child; this.child = child;
} }
......
...@@ -93,10 +93,10 @@ class RenderPadding extends RenderShiftedBox { ...@@ -93,10 +93,10 @@ class RenderPadding extends RenderShiftedBox {
RenderPadding({ RenderPadding({
@required EdgeInsets padding, @required EdgeInsets padding,
RenderBox child RenderBox child
}) : _padding = padding, super(child) { }) : assert(padding != null),
assert(padding != null); assert(padding.isNonNegative),
assert(padding.isNonNegative); _padding = padding,
} super(child);
/// The amount to pad the child in each dimension. /// The amount to pad the child in each dimension.
EdgeInsets get padding => _padding; EdgeInsets get padding => _padding;
...@@ -192,9 +192,9 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox { ...@@ -192,9 +192,9 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
RenderAligningShiftedBox({ RenderAligningShiftedBox({
FractionalOffset alignment: FractionalOffset.center, FractionalOffset alignment: FractionalOffset.center,
RenderBox child RenderBox child
}) : _alignment = alignment, super(child) { }) : assert(alignment != null && alignment.dx != null && alignment.dy != null),
assert(alignment != null && alignment.dx != null && alignment.dy != null); _alignment = alignment,
} super(child);
/// How to align the child. /// How to align the child.
/// ///
...@@ -259,12 +259,11 @@ class RenderPositionedBox extends RenderAligningShiftedBox { ...@@ -259,12 +259,11 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
double widthFactor, double widthFactor,
double heightFactor, double heightFactor,
FractionalOffset alignment: FractionalOffset.center FractionalOffset alignment: FractionalOffset.center
}) : _widthFactor = widthFactor, }) : assert(widthFactor == null || widthFactor >= 0.0),
assert(heightFactor == null || heightFactor >= 0.0),
_widthFactor = widthFactor,
_heightFactor = heightFactor, _heightFactor = heightFactor,
super(child: child, alignment: alignment) { super(child: child, alignment: alignment);
assert(widthFactor == null || widthFactor >= 0.0);
assert(heightFactor == null || heightFactor >= 0.0);
}
/// If non-null, sets its width to the child's width multipled by this factor. /// If non-null, sets its width to the child's width multipled by this factor.
/// ///
...@@ -499,10 +498,9 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox { ...@@ -499,10 +498,9 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
RenderBox child, RenderBox child,
@required Size requestedSize, @required Size requestedSize,
FractionalOffset alignment: FractionalOffset.center FractionalOffset alignment: FractionalOffset.center
}) : _requestedSize = requestedSize, }) : assert(requestedSize != null),
super(child: child, alignment: alignment) { _requestedSize = requestedSize,
assert(requestedSize != null); super(child: child, alignment: alignment);
}
/// The size this render box should attempt to be. /// The size this render box should attempt to be.
Size get requestedSize => _requestedSize; Size get requestedSize => _requestedSize;
...@@ -791,9 +789,9 @@ class RenderCustomSingleChildLayoutBox extends RenderShiftedBox { ...@@ -791,9 +789,9 @@ class RenderCustomSingleChildLayoutBox extends RenderShiftedBox {
RenderCustomSingleChildLayoutBox({ RenderCustomSingleChildLayoutBox({
RenderBox child, RenderBox child,
@required SingleChildLayoutDelegate delegate @required SingleChildLayoutDelegate delegate
}) : _delegate = delegate, super(child) { }) : assert(delegate != null),
assert(delegate != null); _delegate = delegate,
} super(child);
/// A delegate that controls this object's layout. /// A delegate that controls this object's layout.
SingleChildLayoutDelegate get delegate => _delegate; SingleChildLayoutDelegate get delegate => _delegate;
...@@ -901,12 +899,11 @@ class RenderBaseline extends RenderShiftedBox { ...@@ -901,12 +899,11 @@ class RenderBaseline extends RenderShiftedBox {
RenderBox child, RenderBox child,
@required double baseline, @required double baseline,
@required TextBaseline baselineType @required TextBaseline baselineType
}) : _baseline = baseline, }) : assert(baseline != null),
assert(baselineType != null),
_baseline = baseline,
_baselineType = baselineType, _baselineType = baselineType,
super(child) { super(child);
assert(baseline != null);
assert(baselineType != null);
}
/// The number of logical pixels from the top of this box at which to position /// The number of logical pixels from the top of this box at which to position
/// the child's baseline. /// the child's baseline.
......
...@@ -34,10 +34,10 @@ class RenderSliverFillViewport extends RenderSliverFixedExtentBoxAdaptor { ...@@ -34,10 +34,10 @@ class RenderSliverFillViewport extends RenderSliverFixedExtentBoxAdaptor {
RenderSliverFillViewport({ RenderSliverFillViewport({
@required RenderSliverBoxChildManager childManager, @required RenderSliverBoxChildManager childManager,
double viewportFraction: 1.0, double viewportFraction: 1.0,
}) : _viewportFraction = viewportFraction, super(childManager: childManager) { }) : assert(viewportFraction != null),
assert(viewportFraction != null); assert(viewportFraction > 0.0),
assert(viewportFraction > 0.0); _viewportFraction = viewportFraction,
} super(childManager: childManager);
@override @override
double get itemExtent => constraints.viewportMainAxisExtent * viewportFraction; double get itemExtent => constraints.viewportMainAxisExtent * viewportFraction;
......
...@@ -456,10 +456,9 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor { ...@@ -456,10 +456,9 @@ class RenderSliverGrid extends RenderSliverMultiBoxAdaptor {
RenderSliverGrid({ RenderSliverGrid({
@required RenderSliverBoxChildManager childManager, @required RenderSliverBoxChildManager childManager,
@required SliverGridDelegate gridDelegate, @required SliverGridDelegate gridDelegate,
}) : _gridDelegate = gridDelegate, }) : assert(gridDelegate != null),
super(childManager: childManager) { _gridDelegate = gridDelegate,
assert(gridDelegate != null); super(childManager: childManager);
}
@override @override
void setupParentData(RenderObject child) { void setupParentData(RenderObject child) {
......
...@@ -149,9 +149,8 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver ...@@ -149,9 +149,8 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
/// The [childManager] argument must not be null. /// The [childManager] argument must not be null.
RenderSliverMultiBoxAdaptor({ RenderSliverMultiBoxAdaptor({
@required RenderSliverBoxChildManager childManager @required RenderSliverBoxChildManager childManager
}) : _childManager = childManager { }) : assert(childManager != null),
assert(childManager != null); _childManager = childManager;
}
@override @override
void setupParentData(RenderObject child) { void setupParentData(RenderObject child) {
......
...@@ -31,9 +31,9 @@ class RenderSliverPadding extends RenderSliver with RenderObjectWithChildMixin<R ...@@ -31,9 +31,9 @@ class RenderSliverPadding extends RenderSliver with RenderObjectWithChildMixin<R
RenderSliverPadding({ RenderSliverPadding({
@required EdgeInsets padding, @required EdgeInsets padding,
RenderSliver child, RenderSliver child,
}) : _padding = padding { }) : assert(padding != null),
assert(padding != null); assert(padding.isNonNegative),
assert(padding.isNonNegative); _padding = padding {
this.child = child; this.child = child;
} }
......
...@@ -270,11 +270,9 @@ class FloatingHeaderSnapConfiguration { ...@@ -270,11 +270,9 @@ class FloatingHeaderSnapConfiguration {
@required this.vsync, @required this.vsync,
this.curve: Curves.ease, this.curve: Curves.ease,
this.duration: const Duration(milliseconds: 300), this.duration: const Duration(milliseconds: 300),
}) { }) : assert(vsync != null),
assert(vsync != null); assert(curve != null),
assert(curve != null); assert(duration != null);
assert(duration != null);
}
/// The [TickerProvider] for the [AnimationController] that causes a /// The [TickerProvider] for the [AnimationController] that causes a
/// floating header to snap in or out of view. /// floating header to snap in or out of view.
......
...@@ -300,12 +300,12 @@ class RenderStack extends RenderBox ...@@ -300,12 +300,12 @@ class RenderStack extends RenderBox
FractionalOffset alignment: FractionalOffset.topLeft, FractionalOffset alignment: FractionalOffset.topLeft,
StackFit fit: StackFit.loose, StackFit fit: StackFit.loose,
Overflow overflow: Overflow.clip Overflow overflow: Overflow.clip
}) : _alignment = alignment, }) : assert(alignment != null),
assert(fit != null),
assert(overflow != null),
_alignment = alignment,
_fit = fit, _fit = fit,
_overflow = overflow { _overflow = overflow {
assert(alignment != null);
assert(fit != null);
assert(overflow != null);
addAll(children); addAll(children);
} }
......
...@@ -489,12 +489,11 @@ class RenderTable extends RenderBox { ...@@ -489,12 +489,11 @@ class RenderTable extends RenderBox {
TableCellVerticalAlignment defaultVerticalAlignment: TableCellVerticalAlignment.top, TableCellVerticalAlignment defaultVerticalAlignment: TableCellVerticalAlignment.top,
TextBaseline textBaseline, TextBaseline textBaseline,
List<List<RenderBox>> children List<List<RenderBox>> children
}) { }) : assert(columns == null || columns >= 0),
assert(columns == null || columns >= 0); assert(rows == null || rows >= 0),
assert(rows == null || rows >= 0); assert(rows == null || children == null),
assert(rows == null || children == null); assert(defaultColumnWidth != null),
assert(defaultColumnWidth != null); assert(configuration != null) {
assert(configuration != null);
_columns = columns ?? (children != null && children.isNotEmpty ? children.first.length : 0); _columns = columns ?? (children != null && children.isNotEmpty ? children.first.length : 0);
_rows = rows ?? 0; _rows = rows ?? 0;
_children = <RenderBox>[]..length = _columns * _rows; _children = <RenderBox>[]..length = _columns * _rows;
......
...@@ -80,11 +80,10 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix ...@@ -80,11 +80,10 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
RenderViewportBase({ RenderViewportBase({
AxisDirection axisDirection: AxisDirection.down, AxisDirection axisDirection: AxisDirection.down,
@required ViewportOffset offset, @required ViewportOffset offset,
}) : _axisDirection = axisDirection, }) : assert(axisDirection != null),
_offset = offset { assert(offset != null),
assert(axisDirection != null); _axisDirection = axisDirection,
assert(offset != null); _offset = offset;
}
/// The direction in which the [SliverConstraints.scrollOffset] increases. /// The direction in which the [SliverConstraints.scrollOffset] increases.
/// ///
...@@ -639,11 +638,11 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat ...@@ -639,11 +638,11 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
double anchor: 0.0, double anchor: 0.0,
List<RenderSliver> children, List<RenderSliver> children,
RenderSliver center, RenderSliver center,
}) : _anchor = anchor, }) : assert(anchor != null),
assert(anchor >= 0.0 && anchor <= 1.0),
_anchor = anchor,
_center = center, _center = center,
super(axisDirection: axisDirection, offset: offset) { super(axisDirection: axisDirection, offset: offset) {
assert(anchor != null);
assert(anchor >= 0.0 && anchor <= 1.0);
addAll(children); addAll(children);
if (center == null && firstChild != null) if (center == null && firstChild != null)
_center = firstChild; _center = firstChild;
......
...@@ -91,18 +91,18 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr ...@@ -91,18 +91,18 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, Wr
WrapAlignment runAlignment: WrapAlignment.start, WrapAlignment runAlignment: WrapAlignment.start,
double runSpacing: 0.0, double runSpacing: 0.0,
WrapCrossAlignment crossAxisAlignment: WrapCrossAlignment.start, WrapCrossAlignment crossAxisAlignment: WrapCrossAlignment.start,
}) : _direction = direction, }) : assert(direction != null),
assert(alignment != null),
assert(spacing != null),
assert(runAlignment != null),
assert(runSpacing != null),
assert(crossAxisAlignment != null),
_direction = direction,
_alignment = alignment, _alignment = alignment,
_spacing = spacing, _spacing = spacing,
_runAlignment = runAlignment, _runAlignment = runAlignment,
_runSpacing = runSpacing, _runSpacing = runSpacing,
_crossAxisAlignment = crossAxisAlignment { _crossAxisAlignment = crossAxisAlignment {
assert(direction != null);
assert(alignment != null);
assert(spacing != null);
assert(runAlignment != null);
assert(runSpacing != null);
assert(crossAxisAlignment != null);
addAll(children); addAll(children);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment