diff --git a/packages/flutter/lib/src/foundation/serialization.dart b/packages/flutter/lib/src/foundation/serialization.dart index 753de146e70..822d916aa01 100644 --- a/packages/flutter/lib/src/foundation/serialization.dart +++ b/packages/flutter/lib/src/foundation/serialization.dart @@ -103,9 +103,8 @@ class WriteBuffer { /// The byte order used is [Endianness.HOST_ENDIAN] throughout. class ReadBuffer { /// Creates a [ReadBuffer] for reading from the specified [data]. - ReadBuffer(this.data) { - assert(data != null); - } + ReadBuffer(this.data) + : assert(data != null); /// The underlying data being read. final ByteData data; diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart index a03aa5ff6ee..fc92a7e1425 100644 --- a/packages/flutter/lib/src/material/material.dart +++ b/packages/flutter/lib/src/material/material.dart @@ -275,9 +275,12 @@ class _MaterialState extends State with TickerProviderStateMixin { const Duration _kHighlightFadeDuration = const Duration(milliseconds: 200); class _RenderInkFeatures extends RenderProxyBox implements MaterialInkController { - _RenderInkFeatures({ RenderBox child, @required this.vsync, this.color }) : super(child) { - assert(vsync != null); - } + _RenderInkFeatures({ + RenderBox child, + @required this.vsync, + this.color, + }) : assert(vsync != null), + super(child); // This class should exist in a 1:1 relationship with a MaterialState object, // since there's no current support for dynamically changing the ticker diff --git a/packages/flutter/lib/src/painting/box_painter.dart b/packages/flutter/lib/src/painting/box_painter.dart index 4600841df91..d176a87ad4d 100644 --- a/packages/flutter/lib/src/painting/box_painter.dart +++ b/packages/flutter/lib/src/painting/box_painter.dart @@ -1659,9 +1659,9 @@ class BoxDecoration extends Decoration { /// An object that paints a [BoxDecoration] into a canvas. class _BoxDecorationPainter extends BoxPainter { - _BoxDecorationPainter(@required this._decoration, VoidCallback onChange) : super(onChange) { - assert(_decoration != null); - } + _BoxDecorationPainter(@required this._decoration, VoidCallback onChange) + : assert(_decoration != null), + super(onChange); final BoxDecoration _decoration; diff --git a/packages/flutter/lib/src/painting/flutter_logo.dart b/packages/flutter/lib/src/painting/flutter_logo.dart index 97ba120a0fb..3652febb51c 100644 --- a/packages/flutter/lib/src/painting/flutter_logo.dart +++ b/packages/flutter/lib/src/painting/flutter_logo.dart @@ -219,9 +219,10 @@ class FlutterLogoDecoration extends Decoration { /// An object that paints a [BoxDecoration] into a canvas. class _FlutterLogoPainter extends BoxPainter { - _FlutterLogoPainter(this._config) : super(null) { - assert(_config != null); - assert(_config.debugAssertIsValid()); + _FlutterLogoPainter(this._config) + : assert(_config != null), + assert(_config.debugAssertIsValid()), + super(null) { _prepareText(); } diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index a3e77426e42..8c7e458f6c4 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -41,10 +41,13 @@ class TextPainter { double textScaleFactor: 1.0, int maxLines, String ellipsis, - }) : _text = text, _textAlign = textAlign, _textScaleFactor = textScaleFactor, _maxLines = maxLines, _ellipsis = ellipsis { - assert(text == null || text.debugAssertIsValid()); - assert(textScaleFactor != null); - } + }) : assert(text == null || text.debugAssertIsValid()), + assert(textScaleFactor != null), + _text = text, + _textAlign = textAlign, + _textScaleFactor = textScaleFactor, + _maxLines = maxLines, + _ellipsis = ellipsis; ui.Paragraph _paragraph; bool _needsLayout = true; diff --git a/packages/flutter/lib/src/physics/clamped_simulation.dart b/packages/flutter/lib/src/physics/clamped_simulation.dart index 82fe080310f..854936f5ccb 100644 --- a/packages/flutter/lib/src/physics/clamped_simulation.dart +++ b/packages/flutter/lib/src/physics/clamped_simulation.dart @@ -26,11 +26,9 @@ class ClampedSimulation extends Simulation { this.xMax: double.INFINITY, this.dxMin: double.NEGATIVE_INFINITY, this.dxMax: double.INFINITY - }) { - assert(simulation != null); - assert(xMax >= xMin); - assert(dxMax >= dxMin); - } + }) : assert(simulation != null), + assert(xMax >= xMin), + assert(dxMax >= dxMin); /// The simulation being clamped. Calls to [x], [dx], and [isDone] are /// forwarded to the simulation. diff --git a/packages/flutter/lib/src/physics/friction_simulation.dart b/packages/flutter/lib/src/physics/friction_simulation.dart index 10cf766e22c..8fa5cf18d8f 100644 --- a/packages/flutter/lib/src/physics/friction_simulation.dart +++ b/packages/flutter/lib/src/physics/friction_simulation.dart @@ -105,9 +105,8 @@ class BoundedFrictionSimulation extends FrictionSimulation { double velocity, this._minX, this._maxX - ) : super(drag, position, velocity) { - assert(position.clamp(_minX, _maxX) == position); - } + ) : assert(position.clamp(_minX, _maxX) == position), + super(drag, position, velocity); final double _minX; final double _maxX; diff --git a/packages/flutter/lib/src/physics/gravity_simulation.dart b/packages/flutter/lib/src/physics/gravity_simulation.dart index b75eb93bded..5e75c4b4aa8 100644 --- a/packages/flutter/lib/src/physics/gravity_simulation.dart +++ b/packages/flutter/lib/src/physics/gravity_simulation.dart @@ -28,16 +28,15 @@ class GravitySimulation extends Simulation { double distance, double endDistance, double velocity - ) : _a = acceleration, + ) : assert(acceleration != null), + assert(distance != null), + assert(velocity != null), + assert(endDistance != null), + assert(endDistance >= 0), + _a = acceleration, _x = distance, _v = velocity, - _end = endDistance { - assert(acceleration != null); - assert(distance != null); - assert(velocity != null); - assert(endDistance != null); - assert(endDistance >= 0); - } + _end = endDistance; final double _x; final double _v; diff --git a/packages/flutter/lib/src/services/image_stream.dart b/packages/flutter/lib/src/services/image_stream.dart index baa013e0461..f6a1ca57253 100644 --- a/packages/flutter/lib/src/services/image_stream.dart +++ b/packages/flutter/lib/src/services/image_stream.dart @@ -237,8 +237,8 @@ class OneFrameImageStreamCompleter extends ImageStreamCompleter { /// argument on [FlutterErrorDetails] set to true, meaning that by default the /// message is only dumped to the console in debug mode (see [new /// FlutterErrorDetails]). - OneFrameImageStreamCompleter(Future image, { InformationCollector informationCollector }) { - assert(image != null); + OneFrameImageStreamCompleter(Future image, { InformationCollector informationCollector }) + : assert(image != null) { image.then(setImage, onError: (dynamic error, StackTrace stack) { FlutterError.reportError(new FlutterErrorDetails( exception: error, diff --git a/packages/flutter/lib/src/services/message_codec.dart b/packages/flutter/lib/src/services/message_codec.dart index dec6db4c5c8..22691f44e11 100644 --- a/packages/flutter/lib/src/services/message_codec.dart +++ b/packages/flutter/lib/src/services/message_codec.dart @@ -35,9 +35,8 @@ abstract class MessageCodec { class MethodCall { /// Creates a [MethodCall] representing the invocation of [method] with the /// specified [arguments]. - MethodCall(this.method, [this.arguments]) { - assert(method != null); - } + MethodCall(this.method, [this.arguments]) + : assert(method != null); /// The name of the method to be called. final String method; @@ -148,9 +147,7 @@ class PlatformException implements Exception { @required this.code, this.message, this.details, - }) { - assert(code != null); - } + }) : assert(code != null); /// An error code. final String code; diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index e1c4ca87554..a982d9bd80e 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -224,9 +224,9 @@ abstract class TextInputClient { /// /// * [TextInput.attach] class TextInputConnection { - TextInputConnection._(this._client) : _id = _nextId++ { - assert(_client != null); - } + TextInputConnection._(this._client) + : assert(_client != null), + _id = _nextId++; static int _nextId = 1; final int _id;