diff --git a/examples/flutter_gallery/lib/demo/animation/home.dart b/examples/flutter_gallery/lib/demo/animation/home.dart index 336bc1df54..25b0919012 100644 --- a/examples/flutter_gallery/lib/demo/animation/home.dart +++ b/examples/flutter_gallery/lib/demo/animation/home.dart @@ -446,7 +446,7 @@ class _AnimationDemoHomeState extends State { final List headings = []; for (int index = 0; index < allSections.length; index++) { headings.add(new Container( - decoration: new BoxDecoration(backgroundColor: _kAppBackgroundColor), + decoration: const BoxDecoration(backgroundColor: _kAppBackgroundColor), child: new ClipRect( child: new _AllSectionsView( sectionIndex: index, @@ -526,8 +526,8 @@ class _AnimationDemoHomeState extends State { top: statusBarHeight, left: 0.0, child: new IconTheme( - data: new IconThemeData(color: Colors.white), - child: new BackButton(), + data: const IconThemeData(color: Colors.white), + child: const BackButton(), ), ), ], diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart index d903174821..7c17f97fff 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart @@ -57,7 +57,7 @@ class _CupertinoDialogDemoState extends State { onPressed: () { Navigator.pop(context, 'OK'); } ), new CupertinoDialogAction( - child: new Text('Cancel', style: new TextStyle(fontWeight: FontWeight.w600)), + child: new Text('Cancel', style: const TextStyle(fontWeight: FontWeight.w600)), onPressed: () { Navigator.pop(context, 'Cancel'); } ), ] @@ -69,7 +69,7 @@ class _CupertinoDialogDemoState extends State { new CupertinoButton( child: new Text('Alert with Title'), color: CupertinoButton.kBlue, - padding: new EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), + padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 36.0), onPressed: () { showDemoDialog( context: context, diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index bac5e217a6..62f220c3a7 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -451,7 +451,7 @@ class _AppBarState extends State { children: [ new Flexible( child: new ConstrainedBox( - constraints: new BoxConstraints(maxHeight: kToolbarHeight), + constraints: const BoxConstraints(maxHeight: kToolbarHeight), child: appBar, ), ), diff --git a/packages/flutter/lib/src/material/icon_button.dart b/packages/flutter/lib/src/material/icon_button.dart index bb787a66bd..eca207c37d 100644 --- a/packages/flutter/lib/src/material/icon_button.dart +++ b/packages/flutter/lib/src/material/icon_button.dart @@ -143,7 +143,7 @@ class IconButton extends StatelessWidget { currentColor = disabledColor ?? Theme.of(context).disabledColor; Widget result = new ConstrainedBox( - constraints: new BoxConstraints(minWidth: kMinButtonSize, minHeight: kMinButtonSize), + constraints: const BoxConstraints(minWidth: kMinButtonSize, minHeight: kMinButtonSize), child: new Padding( padding: padding, child: new SizedBox( diff --git a/packages/flutter/lib/src/services/message_codecs.dart b/packages/flutter/lib/src/services/message_codecs.dart index 44cd5ca5f7..b135e81f35 100644 --- a/packages/flutter/lib/src/services/message_codecs.dart +++ b/packages/flutter/lib/src/services/message_codecs.dart @@ -205,7 +205,7 @@ class StandardMessageCodec implements MessageCodec { final ReadBuffer buffer = new ReadBuffer(message); final dynamic result = _readValue(buffer); if (buffer.hasRemaining) - throw new FormatException('Message corrupted'); + throw const FormatException('Message corrupted'); return result; } @@ -303,7 +303,7 @@ class StandardMessageCodec implements MessageCodec { static dynamic _readValue(ReadBuffer buffer) { if (!buffer.hasRemaining) - throw throw new FormatException('Message corrupted'); + throw const FormatException('Message corrupted'); dynamic result; switch (buffer.getUint8()) { case _kNull: @@ -363,7 +363,7 @@ class StandardMessageCodec implements MessageCodec { result[_readValue(buffer)] = _readValue(buffer); } break; - default: throw new FormatException('Message corrupted'); + default: throw const FormatException('Message corrupted'); } return result; } @@ -405,7 +405,7 @@ class StandardMethodCodec implements MethodCodec { dynamic decodeEnvelope(ByteData envelope) { // First byte is zero in success case, and non-zero otherwise. if (envelope == null || envelope.lengthInBytes == 0) - throw new FormatException('Expected envelope, got nothing'); + throw const FormatException('Expected envelope, got nothing'); final ReadBuffer buffer = new ReadBuffer(envelope); if (buffer.getUint8() == 0) return StandardMessageCodec._readValue(buffer); @@ -415,6 +415,6 @@ class StandardMethodCodec implements MethodCodec { if (errorCode is String && (errorMessage == null || errorMessage is String)) throw new PlatformException(code: errorCode, message: errorMessage, details: errorDetails); else - throw new FormatException('Invalid envelope'); + throw const FormatException('Invalid envelope'); } } diff --git a/packages/flutter/test/cupertino/button_test.dart b/packages/flutter/test/cupertino/button_test.dart index fc5a1c6384..6ee157d790 100644 --- a/packages/flutter/test/cupertino/button_test.dart +++ b/packages/flutter/test/cupertino/button_test.dart @@ -47,7 +47,7 @@ void main() { await tester.pumpWidget(new Center(child: new CupertinoButton( child: new Text('X', style: testStyle), onPressed: null, - color: new Color(0xFFFFFFFF), + color: const Color(0xFFFFFFFF), ))); final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton)); expect( @@ -61,7 +61,7 @@ void main() { await tester.pumpWidget(new Center(child: new CupertinoButton( child: new Text(' ', style: testStyle), onPressed: null, - padding: new EdgeInsets.all(100.0), + padding: const EdgeInsets.all(100.0), ))); final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton)); expect( diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart index c5cbc5616b..e05024f78c 100644 --- a/packages/flutter/test/material/app_bar_test.dart +++ b/packages/flutter/test/material/app_bar_test.dart @@ -311,8 +311,8 @@ void main() { ); final Finder hamburger = find.byTooltip('Open navigation menu'); - expect(tester.getTopLeft(hamburger), new Point(0.0, 0.0)); - expect(tester.getSize(hamburger), new Size(56.0, 56.0)); + expect(tester.getTopLeft(hamburger), const Point(0.0, 0.0)); + expect(tester.getSize(hamburger), const Size(56.0, 56.0)); }); testWidgets('test action is 4dp from edge and 48dp min', (WidgetTester tester) async { @@ -343,13 +343,13 @@ void main() { final Finder addButton = find.byTooltip('Add'); // Right padding is 4dp. - expect(tester.getTopRight(addButton), new Point(800.0 - 4.0, 0.0)); + expect(tester.getTopRight(addButton), const Point(800.0 - 4.0, 0.0)); // It's still the size it was plus the 2 * 8dp padding from IconButton. - expect(tester.getSize(addButton), new Size(60.0 + 2 * 8.0, 56.0)); + expect(tester.getSize(addButton), const Size(60.0 + 2 * 8.0, 56.0)); final Finder shareButton = find.byTooltip('Share'); // The 20dp icon is expanded to fill the IconButton's touch target to 48dp. - expect(tester.getSize(shareButton), new Size(48.0, 56.0)); + expect(tester.getSize(shareButton), const Size(48.0, 56.0)); }); testWidgets('SliverAppBar default configuration', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/icon_button_test.dart b/packages/flutter/test/material/icon_button_test.dart index dd8220491a..84e99332ef 100644 --- a/packages/flutter/test/material/icon_button_test.dart +++ b/packages/flutter/test/material/icon_button_test.dart @@ -33,7 +33,7 @@ void main() { ); final RenderBox iconButton = tester.renderObject(find.byType(IconButton)); - expect(iconButton.size, new Size(48.0, 48.0)); + expect(iconButton.size, const Size(48.0, 48.0)); await tester.tap(find.byType(IconButton)); expect(mockOnPressedFunction.called, 1); @@ -53,7 +53,7 @@ void main() { ); final RenderBox iconButton = tester.renderObject(find.byType(IconButton)); - expect(iconButton.size, new Size(48.0, 48.0)); + expect(iconButton.size, const Size(48.0, 48.0)); }); testWidgets('test icons can be small when total size is >48dp', (WidgetTester tester) async { @@ -62,7 +62,7 @@ void main() { child: new Center( child: new IconButton( iconSize: 10.0, - padding: new EdgeInsets.all(30.0), + padding: const EdgeInsets.all(30.0), onPressed: mockOnPressedFunction, icon: new Icon(Icons.link), ), @@ -71,7 +71,7 @@ void main() { ); final RenderBox iconButton = tester.renderObject(find.byType(IconButton)); - expect(iconButton.size, new Size(70.0, 70.0)); + expect(iconButton.size, const Size(70.0, 70.0)); }); testWidgets('test default icon buttons are constrained', (WidgetTester tester) async { @@ -89,7 +89,7 @@ void main() { ); final RenderBox box = tester.renderObject(find.byType(IconButton)); - expect(box.size, new Size(80.0, 80.0)); + expect(box.size, const Size(80.0, 80.0)); }); testWidgets( @@ -110,7 +110,7 @@ void main() { ); final RenderBox box = tester.renderObject(find.byType(IconButton)); - expect(box.size, new Size(48.0, 600.0)); + expect(box.size, const Size(48.0, 600.0)); }); testWidgets('test default padding', (WidgetTester tester) async { @@ -127,7 +127,7 @@ void main() { ); final RenderBox box = tester.renderObject(find.byType(IconButton)); - expect(box.size, new Size(96.0, 96.0)); + expect(box.size, const Size(96.0, 96.0)); }); testWidgets('test tooltip', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index f3aede0c65..26eca28ae4 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -44,7 +44,7 @@ void main() { testWidgets('Scaffold large bottom padding test', (WidgetTester tester) async { final Key bodyKey = new UniqueKey(); await tester.pumpWidget(new MediaQuery( - data: new MediaQueryData( + data: const MediaQueryData( padding: const EdgeInsets.only(bottom: 700.0), ), child: new Scaffold( @@ -56,7 +56,7 @@ void main() { expect(bodyBox.size, equals(const Size(800.0, 0.0))); await tester.pumpWidget(new MediaQuery( - data: new MediaQueryData( + data: const MediaQueryData( padding: const EdgeInsets.only(bottom: 500.0), ), child: new Scaffold( @@ -67,7 +67,7 @@ void main() { expect(bodyBox.size, equals(const Size(800.0, 100.0))); await tester.pumpWidget(new MediaQuery( - data: new MediaQueryData( + data: const MediaQueryData( padding: const EdgeInsets.only(bottom: 580.0), ), child: new Scaffold( diff --git a/packages/flutter/test/widgets/scroll_view_test.dart b/packages/flutter/test/widgets/scroll_view_test.dart index 33e63c5f05..64a45927ea 100644 --- a/packages/flutter/test/widgets/scroll_view_test.dart +++ b/packages/flutter/test/widgets/scroll_view_test.dart @@ -269,7 +269,7 @@ void main() { primary: true, children: [ new Container( - constraints: new BoxConstraints(maxHeight: 200.0), + constraints: const BoxConstraints(maxHeight: 200.0), child: new ListView(key: innerKey, primary: true), ), ], diff --git a/packages/flutter/test/widgets/single_child_scroll_view_test.dart b/packages/flutter/test/widgets/single_child_scroll_view_test.dart index 3479b93d04..4edc80b482 100644 --- a/packages/flutter/test/widgets/single_child_scroll_view_test.dart +++ b/packages/flutter/test/widgets/single_child_scroll_view_test.dart @@ -163,7 +163,7 @@ void main() { child: new SingleChildScrollView( primary: true, child: new Container( - constraints: new BoxConstraints(maxHeight: 200.0), + constraints: const BoxConstraints(maxHeight: 200.0), child: new ListView(key: innerKey, primary: true), ), ), diff --git a/packages/flutter_tools/lib/executable.dart b/packages/flutter_tools/lib/executable.dart index f3fa22bf10..d0a9789a31 100644 --- a/packages/flutter_tools/lib/executable.dart +++ b/packages/flutter_tools/lib/executable.dart @@ -238,7 +238,7 @@ Future _handleToolError( /// be recording. Additionally, in the case of a crash we do not trust the /// integrity of the [AppContext]. @visibleForTesting -FileSystem crashFileSystem = new LocalFileSystem(); +FileSystem crashFileSystem = const LocalFileSystem(); /// Saves the crash report to a local file. Future _createLocalCrashReport(List args, dynamic error, Chain chain) async { diff --git a/packages/flutter_tools/lib/src/vmservice_record_replay.dart b/packages/flutter_tools/lib/src/vmservice_record_replay.dart index 2b6470ce03..095b73caae 100644 --- a/packages/flutter_tools/lib/src/vmservice_record_replay.dart +++ b/packages/flutter_tools/lib/src/vmservice_record_replay.dart @@ -36,7 +36,7 @@ class RecordingVMServiceChannel extends DelegatingStreamChannel { _messages.sort(); final File file = _getManifest(location); - final String json = new JsonEncoder.withIndent(' ').convert(_messages); + final String json = const JsonEncoder.withIndent(' ').convert(_messages); await file.writeAsString(json, flush: true); }, ShutdownStage.SERIALIZE_RECORDING); } diff --git a/packages/flutter_tools/test/crash_reporting_test.dart b/packages/flutter_tools/test/crash_reporting_test.dart index b36f26ac01..c131d85fc4 100644 --- a/packages/flutter_tools/test/crash_reporting_test.dart +++ b/packages/flutter_tools/test/crash_reporting_test.dart @@ -28,7 +28,7 @@ void main() { }); tearDown(() { - tools.crashFileSystem = new LocalFileSystem(); + tools.crashFileSystem = const LocalFileSystem(); restoreExitFunction(); exitTestingMode(); });