diff --git a/dev/manual_tests/material_arc.dart b/dev/manual_tests/material_arc.dart index 067ce47757..8ae2ed71d3 100644 --- a/dev/manual_tests/material_arc.dart +++ b/dev/manual_tests/material_arc.dart @@ -393,10 +393,9 @@ class _RectangleDemoState extends State<_RectangleDemo> { typedef Widget _DemoBuilder(_ArcDemo demo); class _ArcDemo { - _ArcDemo(String _title, this.builder, TickerProvider vsync) - : title = _title, - controller = new AnimationController(duration: const Duration(milliseconds: 500), vsync: vsync), - key = new GlobalKey(debugLabel: _title); + _ArcDemo(this.title, this.builder, TickerProvider vsync) + : controller = new AnimationController(duration: const Duration(milliseconds: 500), vsync: vsync), + key = new GlobalKey(debugLabel: title); final String title; final _DemoBuilder builder; diff --git a/examples/flutter_gallery/lib/demo/calculator/logic.dart b/examples/flutter_gallery/lib/demo/calculator/logic.dart index b6b381a084..8934f6fb14 100644 --- a/examples/flutter_gallery/lib/demo/calculator/logic.dart +++ b/examples/flutter_gallery/lib/demo/calculator/logic.dart @@ -66,9 +66,8 @@ enum Operation { Addition, Subtraction, Multiplication, Division } /// A token that represents an arithmetic operation symbol. class OperationToken extends ExpressionToken { - OperationToken(Operation operation) - : operation = operation, - super(opString(operation)); + OperationToken(this.operation) + : super(opString(operation)); Operation operation; diff --git a/examples/layers/rendering/src/sector_layout.dart b/examples/layers/rendering/src/sector_layout.dart index 22811f797d..04025d0136 100644 --- a/examples/layers/rendering/src/sector_layout.dart +++ b/examples/layers/rendering/src/sector_layout.dart @@ -548,11 +548,10 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil } class RenderSolidColor extends RenderDecoratedSector { - RenderSolidColor(Color backgroundColor, { + RenderSolidColor(this.backgroundColor, { this.desiredDeltaRadius: double.INFINITY, this.desiredDeltaTheta: kTwoPi - }) : this.backgroundColor = backgroundColor, - super(new BoxDecoration(backgroundColor: backgroundColor)); + }) : super(new BoxDecoration(backgroundColor: backgroundColor)); double desiredDeltaRadius; double desiredDeltaTheta; diff --git a/examples/layers/rendering/src/solid_color_box.dart b/examples/layers/rendering/src/solid_color_box.dart index a555d7a1f9..c4e51c7bb7 100644 --- a/examples/layers/rendering/src/solid_color_box.dart +++ b/examples/layers/rendering/src/solid_color_box.dart @@ -9,9 +9,8 @@ class RenderSolidColorBox extends RenderDecoratedBox { final Size desiredSize; final Color backgroundColor; - RenderSolidColorBox(Color backgroundColor, { this.desiredSize: Size.infinite }) - : backgroundColor = backgroundColor, - super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); + RenderSolidColorBox(this.backgroundColor, { this.desiredSize: Size.infinite }) + : super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); @override double computeMinIntrinsicWidth(double height) { diff --git a/examples/stocks/lib/stock_row.dart b/examples/stocks/lib/stock_row.dart index cbfb4f1884..40991448e3 100644 --- a/examples/stocks/lib/stock_row.dart +++ b/examples/stocks/lib/stock_row.dart @@ -11,11 +11,11 @@ typedef void StockRowActionCallback(Stock stock); class StockRow extends StatelessWidget { StockRow({ - Stock stock, + this.stock, this.onPressed, this.onDoubleTap, this.onLongPressed - }) : this.stock = stock, super(key: new ObjectKey(stock)); + }) : super(key: new ObjectKey(stock)); final Stock stock; final StockRowActionCallback onPressed; diff --git a/packages/flutter/lib/src/cupertino/activity_indicator.dart b/packages/flutter/lib/src/cupertino/activity_indicator.dart index 2f10680177..e5eb9c80a8 100644 --- a/packages/flutter/lib/src/cupertino/activity_indicator.dart +++ b/packages/flutter/lib/src/cupertino/activity_indicator.dart @@ -86,8 +86,8 @@ final RRect _kTickFundamentalRRect = new RRect.fromLTRBXY(-10.0, 1.0, -5.0, -1.0 class _CupertinoActivityIndicatorPainter extends CustomPainter { _CupertinoActivityIndicatorPainter({ - Animation position, - }) : position = position, super(repaint: position); + this.position, + }) : super(repaint: position); final Animation position; diff --git a/packages/flutter/lib/src/gestures/multitap.dart b/packages/flutter/lib/src/gestures/multitap.dart index ac3b1b33dc..916028c1c6 100644 --- a/packages/flutter/lib/src/gestures/multitap.dart +++ b/packages/flutter/lib/src/gestures/multitap.dart @@ -227,11 +227,10 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { class _TapGesture extends _TapTracker { _TapGesture({ - MultiTapGestureRecognizer gestureRecognizer, + this.gestureRecognizer, PointerEvent event, Duration longTapDelay - }) : gestureRecognizer = gestureRecognizer, - _lastPosition = event.position, + }) : _lastPosition = event.position, super( event: event, entry: GestureBinding.instance.gestureArena.add(event.pointer, gestureRecognizer) diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index 5981c7cb4e..8dda10ff42 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -164,7 +164,7 @@ class AppBar extends StatefulWidget { this.title, this.actions, this.flexibleSpace, - AppBarBottomWidget bottom, + this.bottom, this.elevation: 4, this.backgroundColor, this.brightness, @@ -174,8 +174,7 @@ class AppBar extends StatefulWidget { this.centerTitle, this.toolbarOpacity: 1.0, this.bottomOpacity: 1.0, - }) : bottom = bottom, - _bottomHeight = bottom?.bottomHeight ?? 0.0, + }) : _bottomHeight = bottom?.bottomHeight ?? 0.0, super(key: key) { assert(elevation != null); assert(primary != null); @@ -497,7 +496,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { @required this.title, @required this.actions, @required this.flexibleSpace, - @required AppBarBottomWidget bottom, + @required this.bottom, @required this.elevation, @required this.backgroundColor, @required this.brightness, @@ -510,8 +509,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { @required this.topPadding, @required this.floating, @required this.pinned, - }) : bottom = bottom, - _bottomHeight = bottom?.bottomHeight ?? 0.0 { + }) : _bottomHeight = bottom?.bottomHeight ?? 0.0 { assert(primary || topPadding == 0.0); } diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index 3da586719a..ed0436632c 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -253,13 +253,12 @@ class DataTable extends StatelessWidget { /// otherwise it should be false. DataTable({ Key key, - List columns, + this.columns, this.sortColumnIndex, this.sortAscending: true, this.onSelectAll, this.rows - }) : columns = columns, - _onlyTextColumn = _initOnlyTextColumn(columns), super(key: key) { + }) : _onlyTextColumn = _initOnlyTextColumn(columns), super(key: key) { assert(columns != null); assert(columns.isNotEmpty); assert(sortColumnIndex == null || (sortColumnIndex >= 0 && sortColumnIndex < columns.length)); diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index 5a246a6bee..d24a060866 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -26,14 +26,11 @@ const EdgeInsets _kMenuHorizontalPadding = const EdgeInsets.symmetric(horizontal class _DropdownMenuPainter extends CustomPainter { _DropdownMenuPainter({ - Color color, - int elevation, + this.color, + this.elevation, this.selectedIndex, - Animation resize, - }) : color = color, - elevation = elevation, - resize = resize, - _painter = new BoxDecoration( + this.resize, + }) : _painter = new BoxDecoration( // If you add a background image here, you must provide a real // configuration in the paint() function and you must provide some sort // of onChanged callback here. @@ -95,8 +92,8 @@ class _DropdownScrollBehavior extends ScrollBehavior { class _DropdownMenu extends StatefulWidget { _DropdownMenu({ Key key, - _DropdownRoute route, - }) : route = route, super(key: key); + this.route, + }) : super(key: key); final _DropdownRoute route; diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart index e5d07ddd36..6eed8d1c0b 100644 --- a/packages/flutter/lib/src/material/progress_indicator.dart +++ b/packages/flutter/lib/src/material/progress_indicator.dart @@ -206,18 +206,13 @@ class _CircularProgressIndicatorPainter extends CustomPainter { _CircularProgressIndicatorPainter({ this.valueColor, - double value, - double headValue, - double tailValue, - int stepValue, - double rotationValue, + this.value, + this.headValue, + this.tailValue, + this.stepValue, + this.rotationValue, this.strokeWidth - }) : this.value = value, - this.headValue = headValue, - this.tailValue = tailValue, - this.stepValue = stepValue, - this.rotationValue = rotationValue, - arcStart = value != null + }) : arcStart = value != null ? _kStartAngle : _kStartAngle + tailValue * 3 / 2 * math.PI + rotationValue * math.PI * 1.7 - stepValue * 0.8 * math.PI, arcSweep = value != null diff --git a/packages/flutter/lib/src/painting/flutter_logo.dart b/packages/flutter/lib/src/painting/flutter_logo.dart index 5782ad37f4..58f8990422 100644 --- a/packages/flutter/lib/src/painting/flutter_logo.dart +++ b/packages/flutter/lib/src/painting/flutter_logo.dart @@ -50,10 +50,9 @@ class FlutterLogoDecoration extends Decoration { const FlutterLogoDecoration({ this.swatch: _kDefaultSwatch, this.textColor: const Color(0xFF616161), - FlutterLogoStyle style: FlutterLogoStyle.markOnly, + this.style: FlutterLogoStyle.markOnly, this.margin: EdgeInsets.zero, - }) : style = style, - _position = style == FlutterLogoStyle.markOnly ? 0.0 : style == FlutterLogoStyle.horizontal ? 1.0 : -1.0, // ignore: CONST_EVAL_TYPE_BOOL_NUM_STRING + }) : _position = style == FlutterLogoStyle.markOnly ? 0.0 : style == FlutterLogoStyle.horizontal ? 1.0 : -1.0, // ignore: CONST_EVAL_TYPE_BOOL_NUM_STRING // (see https://github.com/dart-lang/sdk/issues/26980 for details about that ignore statement) _opacity = 1.0; diff --git a/packages/flutter/lib/src/painting/text_editing.dart b/packages/flutter/lib/src/painting/text_editing.dart index a0ccfe2a76..60e145bb89 100644 --- a/packages/flutter/lib/src/painting/text_editing.dart +++ b/packages/flutter/lib/src/painting/text_editing.dart @@ -94,13 +94,11 @@ class TextSelection extends TextRange { /// /// The [baseOffset] and [extentOffset] arguments must not be null. const TextSelection({ - @required int baseOffset, - @required int extentOffset, + @required this.baseOffset, + @required this.extentOffset, this.affinity: TextAffinity.downstream, this.isDirectional: false - }) : baseOffset = baseOffset, - extentOffset = extentOffset, - super( + }) : super( start: baseOffset < extentOffset ? baseOffset : extentOffset, end: baseOffset < extentOffset ? extentOffset : baseOffset ); diff --git a/packages/flutter/lib/src/physics/spring_simulation.dart b/packages/flutter/lib/src/physics/spring_simulation.dart index f1efe61c2d..376e5124a7 100644 --- a/packages/flutter/lib/src/physics/spring_simulation.dart +++ b/packages/flutter/lib/src/physics/spring_simulation.dart @@ -29,12 +29,10 @@ class SpringDescription { /// See [mass] and [springConstant] for the units for those arguments. The /// damping ratio is unitless. SpringDescription.withDampingRatio({ - double mass, - double springConstant, + this.mass, + this.springConstant, double ratio: 1.0 - }) : mass = mass, - springConstant = springConstant, - damping = ratio * 2.0 * math.sqrt(mass * springConstant); + }) : damping = ratio * 2.0 * math.sqrt(mass * springConstant); /// The mass of the spring (m). The units are arbitrary, but all springs /// within a system should use the same mass units. diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 45ad5ae792..29aaa93e1f 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -826,9 +826,9 @@ class LayoutId extends ParentDataWidget { /// Both the child and the id arguments must not be null. LayoutId({ Key key, - @required Object id, + @required this.id, @required Widget child - }) : id = id, super(key: key ?? new ValueKey(id), child: child) { + }) : super(key: key ?? new ValueKey(id), child: child) { assert(child != null); assert(id != null); } @@ -2610,9 +2610,9 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget { /// /// The [renderBox] argument must not be null. WidgetToRenderBoxAdapter({ - @required RenderBox renderBox, + @required this.renderBox, this.onBuild - }) : renderBox = renderBox, + }) : // WidgetToRenderBoxAdapter objects are keyed to their render box. This // prevents the widget being used in the widget hierarchy in two different // places, which would cause the RenderBox to get inserted in multiple diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart index 29a818d1c3..3252d45fb5 100644 --- a/packages/flutter/lib/src/widgets/binding.dart +++ b/packages/flutter/lib/src/widgets/binding.dart @@ -445,9 +445,9 @@ class RenderObjectToWidgetAdapter extends RenderObjectWi /// Used by [WidgetsBinding] to attach the root widget to the [RenderView]. RenderObjectToWidgetAdapter({ this.child, - RenderObjectWithChildMixin container, + this.container, this.debugShortDescription - }) : container = container, super(key: new GlobalObjectKey(container)); + }) : super(key: new GlobalObjectKey(container)); /// The widget below this widget in the tree. final Widget child; diff --git a/packages/flutter/lib/src/widgets/dismissable.dart b/packages/flutter/lib/src/widgets/dismissable.dart index 5ea0b091ab..4556d31303 100644 --- a/packages/flutter/lib/src/widgets/dismissable.dart +++ b/packages/flutter/lib/src/widgets/dismissable.dart @@ -129,8 +129,8 @@ class Dismissable extends StatefulWidget { class _DismissableClipper extends CustomClipper { _DismissableClipper({ this.axis, - Animation moveAnimation - }) : moveAnimation = moveAnimation, super(reclip: moveAnimation) { + this.moveAnimation + }) : super(reclip: moveAnimation) { assert(axis != null); assert(moveAnimation != null); } diff --git a/packages/flutter/lib/src/widgets/overlay.dart b/packages/flutter/lib/src/widgets/overlay.dart index 62c4b3fdcd..948724ad4f 100644 --- a/packages/flutter/lib/src/widgets/overlay.dart +++ b/packages/flutter/lib/src/widgets/overlay.dart @@ -154,7 +154,7 @@ class OverlayEntry { } class _OverlayEntry extends StatefulWidget { - _OverlayEntry(OverlayEntry entry) : entry = entry, super(key: entry._key) { + _OverlayEntry(this.entry) : super(key: entry._key) { assert(entry != null); } diff --git a/packages/flutter/lib/src/widgets/table.dart b/packages/flutter/lib/src/widgets/table.dart index 53549095b3..d87aaca500 100644 --- a/packages/flutter/lib/src/widgets/table.dart +++ b/packages/flutter/lib/src/widgets/table.dart @@ -93,14 +93,13 @@ class Table extends RenderObjectWidget { /// arguments must not be null. Table({ Key key, - List children: const [], + this.children: const [], this.columnWidths, this.defaultColumnWidth: const FlexColumnWidth(1.0), this.border, this.defaultVerticalAlignment: TableCellVerticalAlignment.top, this.textBaseline - }) : children = children, - _rowDecorations = children.any((TableRow row) => row.decoration != null) + }) : _rowDecorations = children.any((TableRow row) => row.decoration != null) ? children.map((TableRow row) => row.decoration).toList(growable: false) : null, super(key: key) { diff --git a/packages/flutter/test/widgets/custom_single_child_layout_test.dart b/packages/flutter/test/widgets/custom_single_child_layout_test.dart index 525abaec1b..37764b33e0 100644 --- a/packages/flutter/test/widgets/custom_single_child_layout_test.dart +++ b/packages/flutter/test/widgets/custom_single_child_layout_test.dart @@ -67,7 +67,7 @@ class FixedSizeLayoutDelegate extends SingleChildLayoutDelegate { } class NotifierLayoutDelegate extends SingleChildLayoutDelegate { - NotifierLayoutDelegate(ValueNotifier size) : size = size, super(relayout: size); + NotifierLayoutDelegate(this.size) : super(relayout: size); final ValueNotifier size; diff --git a/packages/flutter/test/widgets/flow_test.dart b/packages/flutter/test/widgets/flow_test.dart index a3b81c6377..d2510ce93d 100644 --- a/packages/flutter/test/widgets/flow_test.dart +++ b/packages/flutter/test/widgets/flow_test.dart @@ -6,9 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; class TestFlowDelegate extends FlowDelegate { - TestFlowDelegate({ - Animation startOffset - }) : startOffset = startOffset, super(repaint: startOffset); + TestFlowDelegate({this.startOffset}) : super(repaint: startOffset); final Animation startOffset; diff --git a/packages/flutter_driver/lib/src/find.dart b/packages/flutter_driver/lib/src/find.dart index 19895bd263..e32ad36c74 100644 --- a/packages/flutter_driver/lib/src/find.dart +++ b/packages/flutter_driver/lib/src/find.dart @@ -161,9 +161,8 @@ class ByValueKey extends SerializableFinder { final String finderType = 'ByValueKey'; /// Creates a finder given the key value. - ByValueKey(dynamic keyValue) - : this.keyValue = keyValue, - this.keyValueString = '$keyValue', + ByValueKey(this.keyValue) + : this.keyValueString = '$keyValue', this.keyValueType = '${keyValue.runtimeType}' { if (!_supportedKeyValueTypes.contains(keyValue.runtimeType)) throw _createInvalidKeyValueTypeError('$keyValue.runtimeType'); diff --git a/packages/flutter_driver/lib/src/matcher_util.dart b/packages/flutter_driver/lib/src/matcher_util.dart index b6d81a8e4f..697973f500 100644 --- a/packages/flutter_driver/lib/src/matcher_util.dart +++ b/packages/flutter_driver/lib/src/matcher_util.dart @@ -22,9 +22,8 @@ class MatchResult { : hasMatched = true, mismatchDescription = null; - MatchResult._mismatched(String mismatchDescription) - : hasMatched = false, - mismatchDescription = mismatchDescription; + MatchResult._mismatched(this.mismatchDescription) + : hasMatched = false; /// Whether the match succeeded. final bool hasMatched; diff --git a/packages/flutter_driver/lib/src/timeline_summary.dart b/packages/flutter_driver/lib/src/timeline_summary.dart index 4a705b015b..a3f1688ad5 100644 --- a/packages/flutter_driver/lib/src/timeline_summary.dart +++ b/packages/flutter_driver/lib/src/timeline_summary.dart @@ -184,8 +184,6 @@ class TimedEvent { final Duration duration; /// Creates a timed event given begin and end timestamps in microseconds. - TimedEvent(int beginTimeMicros, int endTimeMicros) - : this.beginTimeMicros = beginTimeMicros, - this.endTimeMicros = endTimeMicros, - this.duration = new Duration(microseconds: endTimeMicros - beginTimeMicros); + TimedEvent(this.beginTimeMicros, this.endTimeMicros) + : this.duration = new Duration(microseconds: endTimeMicros - beginTimeMicros); } diff --git a/packages/flutter_test/lib/src/all_elements.dart b/packages/flutter_test/lib/src/all_elements.dart index 2b155292b3..b0db191d65 100644 --- a/packages/flutter_test/lib/src/all_elements.dart +++ b/packages/flutter_test/lib/src/all_elements.dart @@ -23,9 +23,8 @@ Iterable collectAllElementsFrom(Element rootElement, { } class _DepthFirstChildIterator implements Iterator { - _DepthFirstChildIterator(Element rootElement, bool skipOffstage) - : skipOffstage = skipOffstage, - _stack = _reverseChildrenOf(rootElement, skipOffstage).toList(); + _DepthFirstChildIterator(Element rootElement, this.skipOffstage) + : _stack = _reverseChildrenOf(rootElement, skipOffstage).toList(); final bool skipOffstage; diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index ee1918a9f1..57bc39a8b7 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -829,10 +829,9 @@ const int _kPointerDecay = -2; class _LiveTestPointerRecord { _LiveTestPointerRecord( - int pointer, + this.pointer, this.position - ) : pointer = pointer, - color = new HSVColor.fromAHSV(0.8, (35.0 * pointer) % 360.0, 1.0, 1.0).toColor(), + ) : color = new HSVColor.fromAHSV(0.8, (35.0 * pointer) % 360.0, 1.0, 1.0).toColor(), decay = 1; final int pointer; final Color color; diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index bd25b911bd..2aefc8681f 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -298,13 +298,12 @@ class _DevFSHttpWriter { class DevFS { /// Create a [DevFS] named [fsName] for the local files in [directory]. DevFS(VMService serviceProtocol, - String fsName, + this.fsName, this.rootDirectory, { String packagesFilePath }) : _operations = new ServiceProtocolDevFSOperations(serviceProtocol), - _httpWriter = new _DevFSHttpWriter(fsName, serviceProtocol), - fsName = fsName { + _httpWriter = new _DevFSHttpWriter(fsName, serviceProtocol) { _packagesFilePath = packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName); }