From b5f328e37eaf5adbcf010aee1071a48a89e2d0e8 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Fri, 31 Jan 2020 18:30:21 +0100 Subject: [PATCH] remove unnecessary string interpolations (#49622) --- .../test_apps/stocks/lib/stock_symbol_viewer.dart | 4 ++-- dev/bots/unpublish_package.dart | 2 +- dev/customer_testing/run_tests.dart | 2 +- dev/devicelab/bin/tasks/named_isolates_test.dart | 2 +- dev/manual_tests/lib/density.dart | 10 +++++----- dev/tools/gen_keycodes/lib/code_gen.dart | 2 +- dev/tools/localization/localizations_utils.dart | 2 +- examples/catalog/bin/sample_page.dart | 2 +- .../lib/demo/material/data_table_demo.dart | 6 +++--- .../lib/demo/material/full_screen_dialog_demo.dart | 2 +- .../flutter_gallery/lib/demo/material/tabs_demo.dart | 2 +- examples/flutter_gallery/lib/gallery/options.dart | 8 ++++---- packages/flutter/lib/src/animation/animation.dart | 2 +- packages/flutter/lib/src/animation/curves.dart | 2 +- packages/flutter/lib/src/foundation/assertions.dart | 4 ++-- packages/flutter/lib/src/foundation/diagnostics.dart | 4 ++-- packages/flutter/lib/src/gestures/mouse_tracking.dart | 2 +- .../src/material/floating_action_button_location.dart | 4 ++-- packages/flutter/lib/src/painting/decoration.dart | 2 +- packages/flutter/lib/src/painting/strut_style.dart | 2 +- packages/flutter/lib/src/painting/text_span.dart | 2 +- packages/flutter/lib/src/painting/text_style.dart | 2 +- packages/flutter/lib/src/physics/simulation.dart | 2 +- packages/flutter/lib/src/rendering/custom_layout.dart | 2 +- packages/flutter/lib/src/rendering/flow.dart | 2 +- packages/flutter/lib/src/rendering/proxy_box.dart | 2 +- packages/flutter/lib/src/rendering/sliver.dart | 2 +- packages/flutter/lib/src/rendering/table.dart | 2 +- packages/flutter/lib/src/semantics/semantics.dart | 4 ++-- packages/flutter/lib/src/widgets/basic.dart | 4 ++-- packages/flutter/lib/src/widgets/debug.dart | 2 +- .../lib/src/widgets/draggable_scrollable_sheet.dart | 2 +- packages/flutter/lib/src/widgets/framework.dart | 5 +++-- .../flutter/lib/src/widgets/implicit_animations.dart | 2 +- packages/flutter/lib/src/widgets/routes.dart | 2 +- packages/flutter/lib/src/widgets/scroll_activity.dart | 4 ++-- .../flutter/lib/src/widgets/scroll_configuration.dart | 2 +- packages/flutter/lib/src/widgets/shortcuts.dart | 2 +- packages/flutter/test/material/slider_theme_test.dart | 2 +- packages/flutter/test/widgets/semantics_tester.dart | 2 +- .../test/material/date_picker_test.dart | 2 +- packages/flutter_test/lib/src/test_async_utils.dart | 4 ++-- .../flutter_tools/lib/src/android/android_studio.dart | 2 +- .../flutter_tools/lib/src/build_runner/web_fs.dart | 2 +- packages/flutter_tools/lib/src/cache.dart | 2 +- .../lib/src/commands/update_packages.dart | 2 +- packages/flutter_tools/lib/src/compile.dart | 5 +++-- packages/flutter_tools/lib/src/device.dart | 2 +- packages/flutter_tools/lib/src/ios/devices.dart | 2 +- packages/flutter_tools/lib/src/ios/mac.dart | 2 +- packages/flutter_tools/lib/src/macos/build_macos.dart | 2 +- packages/flutter_tools/lib/src/reporting/events.dart | 6 +++--- packages/flutter_tools/lib/src/test/test_compiler.dart | 2 +- .../general.shard/build_system/targets/macos_test.dart | 2 +- .../runner/flutter_command_runner_test.dart | 2 +- 55 files changed, 78 insertions(+), 76 deletions(-) diff --git a/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart b/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart index e375ace1651..88a2f8efb02 100644 --- a/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart +++ b/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart @@ -29,7 +29,7 @@ class _StockSymbolView extends StatelessWidget { Row( children: [ Text( - '${stock.symbol}', + stock.symbol, key: ValueKey('${stock.symbol}_symbol_name'), style: Theme.of(context).textTheme.headline3, ), @@ -43,7 +43,7 @@ class _StockSymbolView extends StatelessWidget { height: 8.0 ), Text('Market Cap', style: headings), - Text('${stock.marketCap}'), + Text(stock.marketCap), Container( height: 8.0 ), diff --git a/dev/bots/unpublish_package.dart b/dev/bots/unpublish_package.dart index 581cd8f66c9..5385ec2b220 100644 --- a/dev/bots/unpublish_package.dart +++ b/dev/bots/unpublish_package.dart @@ -391,7 +391,7 @@ void _printBanner(String message) { final String banner = '*** $message ***'; print('\n'); print('*' * banner.length); - print('$banner'); + print(banner); print('*' * banner.length); print('\n'); } diff --git a/dev/customer_testing/run_tests.dart b/dev/customer_testing/run_tests.dart index 62133a4fd9e..4a662ba830a 100644 --- a/dev/customer_testing/run_tests.dart +++ b/dev/customer_testing/run_tests.dart @@ -272,7 +272,7 @@ Future shell(String command, Directory directory, { bool verbose = false, print('>> $command'); Process process; if (Platform.isWindows) { - process = await Process.start('CMD.EXE', ['/S', '/C', '$command'], workingDirectory: directory.path); + process = await Process.start('CMD.EXE', ['/S', '/C', command], workingDirectory: directory.path); } else { final List segments = command.trim().split(_spaces); process = await Process.start(segments.first, segments.skip(1).toList(), workingDirectory: directory.path); diff --git a/dev/devicelab/bin/tasks/named_isolates_test.dart b/dev/devicelab/bin/tasks/named_isolates_test.dart index acfa1cd9ad6..af0bf604467 100644 --- a/dev/devicelab/bin/tasks/named_isolates_test.dart +++ b/dev/devicelab/bin/tasks/named_isolates_test.dart @@ -51,7 +51,7 @@ void main() { print('Extracted observatory port: $observatoryUri'); final Process attachProcess = await _run(device: device, command: ['attach', '--debug-uri', - observatoryUri, '--isolate-filter', '$_kSecondIsolateName'], stdoutListener: (String line) { + observatoryUri, '--isolate-filter', _kSecondIsolateName], stdoutListener: (String line) { if (line.contains(_kFirstIsolateName)) { firstNameFound.complete(); } else if (line.contains(_kSecondIsolateName)) { diff --git a/dev/manual_tests/lib/density.dart b/dev/manual_tests/lib/density.dart index 6c94ffc74c1..b49d4d42a97 100644 --- a/dev/manual_tests/lib/density.dart +++ b/dev/manual_tests/lib/density.dart @@ -246,7 +246,7 @@ class _OptionsState extends State { ), ), Text( - '${widget.model.size.toStringAsFixed(3)}', + widget.model.size.toStringAsFixed(3), style: TextStyle(color: Colors.grey[50]), ), ], @@ -261,7 +261,7 @@ class _OptionsState extends State { child: SliderTheme( data: controlTheme, child: Slider( - label: '${widget.model.density.horizontal.toStringAsFixed(1)}', + label: widget.model.density.horizontal.toStringAsFixed(1), min: VisualDensity.minimumDensity, max: VisualDensity.maximumDensity, onChanged: (double value) { @@ -272,7 +272,7 @@ class _OptionsState extends State { ), ), Text( - '${widget.model.density.horizontal.toStringAsFixed(3)}', + widget.model.density.horizontal.toStringAsFixed(3), style: TextStyle(color: Colors.grey[50]), ), ], @@ -287,7 +287,7 @@ class _OptionsState extends State { child: SliderTheme( data: controlTheme, child: Slider( - label: '${widget.model.density.vertical.toStringAsFixed(1)}', + label: widget.model.density.vertical.toStringAsFixed(1), min: VisualDensity.minimumDensity, max: VisualDensity.maximumDensity, onChanged: (double value) { @@ -298,7 +298,7 @@ class _OptionsState extends State { ), ), Text( - '${widget.model.density.vertical.toStringAsFixed(3)}', + widget.model.density.vertical.toStringAsFixed(3), style: TextStyle(color: Colors.grey[50]), ), ], diff --git a/dev/tools/gen_keycodes/lib/code_gen.dart b/dev/tools/gen_keycodes/lib/code_gen.dart index c7f006a18f8..7d80476130a 100644 --- a/dev/tools/gen_keycodes/lib/code_gen.dart +++ b/dev/tools/gen_keycodes/lib/code_gen.dart @@ -25,7 +25,7 @@ class CodeGenerator { currentLine += ' $word'; } else { result.writeln('$prefix$currentLine'); - currentLine = '$word'; + currentLine = word; } } if (currentLine.isNotEmpty) { diff --git a/dev/tools/localization/localizations_utils.dart b/dev/tools/localization/localizations_utils.dart index e6b0a6619e7..79c294d9dea 100644 --- a/dev/tools/localization/localizations_utils.dart +++ b/dev/tools/localization/localizations_utils.dart @@ -339,7 +339,7 @@ String describeLocale(String tag) { assert(subtags.isNotEmpty); assert(_languages.containsKey(subtags[0])); final String language = _languages[subtags[0]]; - String output = '$language'; + String output = language; String region; String script; if (subtags.length == 2) { diff --git a/examples/catalog/bin/sample_page.dart b/examples/catalog/bin/sample_page.dart index 852e7180afb..6e1ae655a3b 100644 --- a/examples/catalog/bin/sample_page.dart +++ b/examples/catalog/bin/sample_page.dart @@ -202,7 +202,7 @@ void generate(String commit) { outputFile('${className}_index.md'), inputFile('bin', 'class_index.md.template').readAsStringSync(), { - 'class': '$className', + 'class': className, 'entries': entries.join('\n'), 'link': '${className}_index', }, diff --git a/examples/flutter_gallery/lib/demo/material/data_table_demo.dart b/examples/flutter_gallery/lib/demo/material/data_table_demo.dart index da59408583a..507c181131c 100644 --- a/examples/flutter_gallery/lib/demo/material/data_table_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/data_table_demo.dart @@ -113,11 +113,11 @@ class DessertDataSource extends DataTableSource { } }, cells: [ - DataCell(Text('${dessert.name}')), + DataCell(Text(dessert.name)), DataCell(Text('${dessert.calories}')), - DataCell(Text('${dessert.fat.toStringAsFixed(1)}')), + DataCell(Text(dessert.fat.toStringAsFixed(1))), DataCell(Text('${dessert.carbs}')), - DataCell(Text('${dessert.protein.toStringAsFixed(1)}')), + DataCell(Text(dessert.protein.toStringAsFixed(1))), DataCell(Text('${dessert.sodium}')), DataCell(Text('${dessert.calcium}%')), DataCell(Text('${dessert.iron}%')), diff --git a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart index 775a6882151..a3a6eeb54e6 100644 --- a/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart @@ -83,7 +83,7 @@ class DateTimeItem extends StatelessWidget { }, child: Row( children: [ - Text('${time.format(context)}'), + Text(time.format(context)), const Icon(Icons.arrow_drop_down, color: Colors.black54), ], ), diff --git a/examples/flutter_gallery/lib/demo/material/tabs_demo.dart b/examples/flutter_gallery/lib/demo/material/tabs_demo.dart index d1ec37526ea..9cef2c057e2 100644 --- a/examples/flutter_gallery/lib/demo/material/tabs_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/tabs_demo.dart @@ -113,7 +113,7 @@ class _CardDataItem extends StatelessWidget { alignment: page.id == 'H' ? Alignment.centerLeft : Alignment.centerRight, - child: CircleAvatar(child: Text('${page.id}')), + child: CircleAvatar(child: Text(page.id)), ), SizedBox( width: 144.0, diff --git a/examples/flutter_gallery/lib/gallery/options.dart b/examples/flutter_gallery/lib/gallery/options.dart index a3b57c082bb..0bb47657a3e 100644 --- a/examples/flutter_gallery/lib/gallery/options.dart +++ b/examples/flutter_gallery/lib/gallery/options.dart @@ -231,7 +231,7 @@ class _ThemeModeItem extends StatelessWidget { children: [ const Text('Theme'), Text( - '${modeLabels[options.themeMode]}', + modeLabels[options.themeMode], style: Theme.of(context).primaryTextTheme.bodyText2, ), ], @@ -278,7 +278,7 @@ class _TextScaleFactorItem extends StatelessWidget { children: [ const Text('Text size'), Text( - '${options.textScaleFactor.label}', + options.textScaleFactor.label, style: Theme.of(context).primaryTextTheme.bodyText2, ), ], @@ -324,7 +324,7 @@ class _VisualDensityItem extends StatelessWidget { children: [ const Text('Visual density'), Text( - '${options.visualDensity.label}', + options.visualDensity.label, style: Theme.of(context).primaryTextTheme.bodyText2, ), ], @@ -431,7 +431,7 @@ class _PlatformItem extends StatelessWidget { children: [ const Text('Platform mechanics'), Text( - '${_platformLabel(options.platform)}', + _platformLabel(options.platform), style: Theme.of(context).primaryTextTheme.bodyText2, ), ], diff --git a/packages/flutter/lib/src/animation/animation.dart b/packages/flutter/lib/src/animation/animation.dart index 9f6785528b1..b1cfaa370ea 100644 --- a/packages/flutter/lib/src/animation/animation.dart +++ b/packages/flutter/lib/src/animation/animation.dart @@ -207,6 +207,6 @@ abstract class Animation extends Listenable implements ValueListenable { break; } assert(icon != null); - return '$icon'; + return icon; } } diff --git a/packages/flutter/lib/src/animation/curves.dart b/packages/flutter/lib/src/animation/curves.dart index 6d52f1e49f0..707ee10de30 100644 --- a/packages/flutter/lib/src/animation/curves.dart +++ b/packages/flutter/lib/src/animation/curves.dart @@ -46,7 +46,7 @@ abstract class ParametricCurve { } @override - String toString() => '${objectRuntimeType(this, 'ParametricCurve')}'; + String toString() => objectRuntimeType(this, 'ParametricCurve'); } /// An parametric animation easing curve, i.e. a mapping of the unit interval to diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart index 7381a7b1501..9d4318d501f 100644 --- a/packages/flutter/lib/src/foundation/assertions.dart +++ b/packages/flutter/lib/src/foundation/assertions.dart @@ -381,7 +381,7 @@ class FlutterErrorDetails extends Diagnosticable { debugFillProperties(builder); summary = builder.properties.firstWhere((DiagnosticsNode node) => node.level == DiagnosticLevel.summary, orElse: () => null); } - return summary ?? ErrorSummary('${formatException()}'); + return summary ?? ErrorSummary(formatException()); } @override @@ -415,7 +415,7 @@ class FlutterErrorDetails extends Diagnosticable { String message = exceptionAsString(); if (message.startsWith(prefix)) message = message.substring(prefix.length); - properties.add(ErrorSummary('$message')); + properties.add(ErrorSummary(message)); } } diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index 04c2f3f9e8f..c857e069970 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -1277,7 +1277,7 @@ class TextTreeRenderer { // with cases where a single line properties output may not have single // linebreak. final String propertyRender = render(property, - prefixLineOne: '${propertyStyle.prefixLineOne}', + prefixLineOne: propertyStyle.prefixLineOne, prefixOtherLines: '${propertyStyle.childLinkSpace}${propertyStyle.prefixOtherLines}', parentConfiguration: config, ); @@ -1306,7 +1306,7 @@ class TextTreeRenderer { if (!config.lineBreakProperties) builder.write(config.lineBreak); - final String prefixChildren = '${config.bodyIndent}'; + final String prefixChildren = config.bodyIndent; final String prefixChildrenRaw = '$prefixOtherLines$prefixChildren'; if (children.isEmpty && config.addBlankLineIfNoChildren && diff --git a/packages/flutter/lib/src/gestures/mouse_tracking.dart b/packages/flutter/lib/src/gestures/mouse_tracking.dart index 381812e4a3a..7b79f363111 100644 --- a/packages/flutter/lib/src/gestures/mouse_tracking.dart +++ b/packages/flutter/lib/src/gestures/mouse_tracking.dart @@ -134,7 +134,7 @@ class _MouseState { @override String toString() { String describeEvent(PointerEvent event) { - return event == null ? 'null' : '${describeIdentity(event)}'; + return event == null ? 'null' : describeIdentity(event); } final String describeLatestEvent = 'latestEvent: ${describeEvent(latestEvent)}'; final String describeAnnotations = 'annotations: [list of ${annotations.length}]'; diff --git a/packages/flutter/lib/src/material/floating_action_button_location.dart b/packages/flutter/lib/src/material/floating_action_button_location.dart index 533eaf2aa31..fd1ec085033 100644 --- a/packages/flutter/lib/src/material/floating_action_button_location.dart +++ b/packages/flutter/lib/src/material/floating_action_button_location.dart @@ -122,7 +122,7 @@ abstract class FloatingActionButtonLocation { Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry); @override - String toString() => '${objectRuntimeType(this, 'FloatingActionButtonLocation')}'; + String toString() => objectRuntimeType(this, 'FloatingActionButtonLocation'); } double _leftOffset(ScaffoldPrelayoutGeometry scaffoldGeometry, { double offset = 0.0 }) { @@ -407,7 +407,7 @@ abstract class FloatingActionButtonAnimator { double getAnimationRestart(double previousValue) => 0.0; @override - String toString() => '${objectRuntimeType(this, 'FloatingActionButtonAnimator')}'; + String toString() => objectRuntimeType(this, 'FloatingActionButtonAnimator'); } class _ScalingFabMotionAnimator extends FloatingActionButtonAnimator { diff --git a/packages/flutter/lib/src/painting/decoration.dart b/packages/flutter/lib/src/painting/decoration.dart index 03e665a3119..a629ce7b396 100644 --- a/packages/flutter/lib/src/painting/decoration.dart +++ b/packages/flutter/lib/src/painting/decoration.dart @@ -26,7 +26,7 @@ abstract class Decoration extends Diagnosticable { const Decoration(); @override - String toStringShort() => '${objectRuntimeType(this, 'Decoration')}'; + String toStringShort() => objectRuntimeType(this, 'Decoration'); /// In checked mode, throws an exception if the object is not in a /// valid configuration. Otherwise, returns true. diff --git a/packages/flutter/lib/src/painting/strut_style.dart b/packages/flutter/lib/src/painting/strut_style.dart index 66f71860bd9..2cd5b3e8f3c 100644 --- a/packages/flutter/lib/src/painting/strut_style.dart +++ b/packages/flutter/lib/src/painting/strut_style.dart @@ -571,7 +571,7 @@ class StrutStyle extends Diagnosticable { } @override - String toStringShort() => '${objectRuntimeType(this, 'StrutStyle')}'; + String toStringShort() => objectRuntimeType(this, 'StrutStyle'); /// Adds all properties prefixing property names with the optional `prefix`. @override diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart index a174b4c8cd9..23872942034 100644 --- a/packages/flutter/lib/src/painting/text_span.dart +++ b/packages/flutter/lib/src/painting/text_span.dart @@ -440,7 +440,7 @@ class TextSpan extends InlineSpan { ); @override - String toStringShort() => '${objectRuntimeType(this, 'TextSpan')}'; + String toStringShort() => objectRuntimeType(this, 'TextSpan'); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index e0bccb6f49d..f78fa1f5c01 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -1197,7 +1197,7 @@ class TextStyle extends Diagnosticable { } @override - String toStringShort() => '${objectRuntimeType(this, 'TextStyle')}'; + String toStringShort() => objectRuntimeType(this, 'TextStyle'); /// Adds all properties prefixing property names with the optional `prefix`. @override diff --git a/packages/flutter/lib/src/physics/simulation.dart b/packages/flutter/lib/src/physics/simulation.dart index 9a9f6652910..fc6732185ee 100644 --- a/packages/flutter/lib/src/physics/simulation.dart +++ b/packages/flutter/lib/src/physics/simulation.dart @@ -54,5 +54,5 @@ abstract class Simulation { Tolerance tolerance; @override - String toString() => '${objectRuntimeType(this, 'Simulation')}'; + String toString() => objectRuntimeType(this, 'Simulation'); } diff --git a/packages/flutter/lib/src/rendering/custom_layout.dart b/packages/flutter/lib/src/rendering/custom_layout.dart index af8ee034788..71dd11277d2 100644 --- a/packages/flutter/lib/src/rendering/custom_layout.dart +++ b/packages/flutter/lib/src/rendering/custom_layout.dart @@ -294,7 +294,7 @@ abstract class MultiChildLayoutDelegate { /// /// By default, returns the [runtimeType] of the class. @override - String toString() => '${objectRuntimeType(this, 'MultiChildLayoutDelegate')}'; + String toString() => objectRuntimeType(this, 'MultiChildLayoutDelegate'); } /// Defers the layout of multiple children to a delegate. diff --git a/packages/flutter/lib/src/rendering/flow.dart b/packages/flutter/lib/src/rendering/flow.dart index dcc9d530908..15b14479313 100644 --- a/packages/flutter/lib/src/rendering/flow.dart +++ b/packages/flutter/lib/src/rendering/flow.dart @@ -132,7 +132,7 @@ abstract class FlowDelegate { /// /// By default, returns the [runtimeType] of the class. @override - String toString() => '${objectRuntimeType(this, 'FlowDelegate')}'; + String toString() => objectRuntimeType(this, 'FlowDelegate'); } /// Parent data for use with [RenderFlow]. diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart index 40cb441ca44..9f49fb3fe3d 100644 --- a/packages/flutter/lib/src/rendering/proxy_box.dart +++ b/packages/flutter/lib/src/rendering/proxy_box.dart @@ -1138,7 +1138,7 @@ abstract class CustomClipper { bool shouldReclip(covariant CustomClipper oldClipper); @override - String toString() => '${objectRuntimeType(this, 'CustomClipper')}'; + String toString() => objectRuntimeType(this, 'CustomClipper'); } /// A [CustomClipper] that clips to the outer path of a [ShapeBorder]. diff --git a/packages/flutter/lib/src/rendering/sliver.dart b/packages/flutter/lib/src/rendering/sliver.dart index d56720c96bd..bd3be14ced4 100644 --- a/packages/flutter/lib/src/rendering/sliver.dart +++ b/packages/flutter/lib/src/rendering/sliver.dart @@ -759,7 +759,7 @@ class SliverGeometry extends Diagnosticable { } @override - String toStringShort() => '${objectRuntimeType(this, 'SliverGeometry')}'; + String toStringShort() => objectRuntimeType(this, 'SliverGeometry'); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index b7ca6c4057d..f627f952e0b 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart @@ -76,7 +76,7 @@ abstract class TableColumnWidth { double flex(Iterable cells) => null; @override - String toString() => '${objectRuntimeType(this, 'TableColumnWidth')}'; + String toString() => objectRuntimeType(this, 'TableColumnWidth'); } /// Sizes the column according to the intrinsic dimensions of all the diff --git a/packages/flutter/lib/src/semantics/semantics.dart b/packages/flutter/lib/src/semantics/semantics.dart index 495b4ae250b..148a473aa8a 100644 --- a/packages/flutter/lib/src/semantics/semantics.dart +++ b/packages/flutter/lib/src/semantics/semantics.dart @@ -376,7 +376,7 @@ class SemanticsData extends Diagnosticable { bool hasAction(SemanticsAction action) => (actions & action.index) != 0; @override - String toStringShort() => '${objectRuntimeType(this, 'SemanticsData')}'; + String toStringShort() => objectRuntimeType(this, 'SemanticsData'); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { @@ -1150,7 +1150,7 @@ class SemanticsProperties extends DiagnosticableTree { } @override - String toStringShort() => '${objectRuntimeType(this, 'SemanticsProperties')}'; // the hashCode isn't important since we're immutable + String toStringShort() => objectRuntimeType(this, 'SemanticsProperties'); // the hashCode isn't important since we're immutable } /// In tests use this function to reset the counter used to generate diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 8b380f3bf49..e3a70f30aad 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -2099,9 +2099,9 @@ class SizedBox extends SingleChildRenderObjectWidget { } else if (width == 0.0 && height == 0.0) { type = '${objectRuntimeType(this, 'SizedBox')}.shrink'; } else { - type = '${objectRuntimeType(this, 'SizedBox')}'; + type = objectRuntimeType(this, 'SizedBox'); } - return key == null ? '$type' : '$type-$key'; + return key == null ? type : '$type-$key'; } @override diff --git a/packages/flutter/lib/src/widgets/debug.dart b/packages/flutter/lib/src/widgets/debug.dart index 79a8746fe96..e61374721e4 100644 --- a/packages/flutter/lib/src/widgets/debug.dart +++ b/packages/flutter/lib/src/widgets/debug.dart @@ -315,7 +315,7 @@ bool debugAssertAllWidgetVarsUnset(String reason) { debugPrintGlobalKeyedWidgetLifecycle || debugProfileBuildsEnabled || debugHighlightDeprecatedWidgets) { - throw FlutterError.fromParts([ErrorSummary('$reason')]); + throw FlutterError.fromParts([ErrorSummary(reason)]); } return true; }()); diff --git a/packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart b/packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart index 71d3b29d111..753496495d7 100644 --- a/packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart +++ b/packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart @@ -476,7 +476,7 @@ class _DraggableScrollableSheetScrollPosition ); final AnimationController ballisticController = AnimationController.unbounded( - debugLabel: '${objectRuntimeType(this, '_DraggableScrollableSheetPosition')}', + debugLabel: objectRuntimeType(this, '_DraggableScrollableSheetPosition'), vsync: context.vsync, ); double lastDelta = 0; diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index d2a53d36a37..0807fa944af 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -443,7 +443,8 @@ abstract class Widget extends DiagnosticableTree { /// A short, textual description of this widget. @override String toStringShort() { - return key == null ? '${objectRuntimeType(this, 'Widget')}' : '${objectRuntimeType(this, 'Widget')}-$key'; + final String type = objectRuntimeType(this, 'Widget'); + return key == null ? type : '$type-$key'; } @override @@ -3958,7 +3959,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { /// A short, textual description of this element. @override String toStringShort() { - return widget != null ? '${widget.toStringShort()}' : '[${objectRuntimeType(this, 'Element')}]'; + return widget != null ? widget.toStringShort() : '[${objectRuntimeType(this, 'Element')}]'; } @override diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart index efd31e1da25..a6ba5360d57 100644 --- a/packages/flutter/lib/src/widgets/implicit_animations.dart +++ b/packages/flutter/lib/src/widgets/implicit_animations.dart @@ -360,7 +360,7 @@ abstract class ImplicitlyAnimatedWidgetState super.initState(); _controller = AnimationController( duration: widget.duration, - debugLabel: kDebugMode ? '${widget.toStringShort()}' : null, + debugLabel: kDebugMode ? widget.toStringShort() : null, vsync: this, ); _controller.addStatusListener((AnimationStatus status) { diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index d730dcedfb0..9933eb20524 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -363,7 +363,7 @@ abstract class TransitionRoute extends OverlayRoute { } /// A short description of this route useful for debugging. - String get debugLabel => '${objectRuntimeType(this, 'TransitionRoute')}'; + String get debugLabel => objectRuntimeType(this, 'TransitionRoute'); @override String toString() => '${objectRuntimeType(this, 'TransitionRoute')}(animation: $_controller)'; diff --git a/packages/flutter/lib/src/widgets/scroll_activity.dart b/packages/flutter/lib/src/widgets/scroll_activity.dart index 3487ecf4dc8..0ce728c4300 100644 --- a/packages/flutter/lib/src/widgets/scroll_activity.dart +++ b/packages/flutter/lib/src/widgets/scroll_activity.dart @@ -507,7 +507,7 @@ class BallisticScrollActivity extends ScrollActivity { TickerProvider vsync, ) : super(delegate) { _controller = AnimationController.unbounded( - debugLabel: kDebugMode ? '${objectRuntimeType(this, 'BallisticScrollActivity')}' : null, + debugLabel: kDebugMode ? objectRuntimeType(this, 'BallisticScrollActivity') : null, vsync: vsync, ) ..addListener(_tick) @@ -604,7 +604,7 @@ class DrivenScrollActivity extends ScrollActivity { _completer = Completer(); _controller = AnimationController.unbounded( value: from, - debugLabel: '${objectRuntimeType(this, 'DrivenScrollActivity')}', + debugLabel: objectRuntimeType(this, 'DrivenScrollActivity'), vsync: vsync, ) ..addListener(_tick) diff --git a/packages/flutter/lib/src/widgets/scroll_configuration.dart b/packages/flutter/lib/src/widgets/scroll_configuration.dart index a3e0d3ea2da..f295b18a592 100644 --- a/packages/flutter/lib/src/widgets/scroll_configuration.dart +++ b/packages/flutter/lib/src/widgets/scroll_configuration.dart @@ -77,7 +77,7 @@ class ScrollBehavior { bool shouldNotify(covariant ScrollBehavior oldDelegate) => false; @override - String toString() => '${objectRuntimeType(this, 'ScrollBehavior')}'; + String toString() => objectRuntimeType(this, 'ScrollBehavior'); } /// Controls how [Scrollable] widgets behave in a subtree. diff --git a/packages/flutter/lib/src/widgets/shortcuts.dart b/packages/flutter/lib/src/widgets/shortcuts.dart index d7e10760ff7..d346a9864db 100644 --- a/packages/flutter/lib/src/widgets/shortcuts.dart +++ b/packages/flutter/lib/src/widgets/shortcuts.dart @@ -156,7 +156,7 @@ class LogicalKeySet extends KeySet with DiagnosticableMixin return a.debugName.compareTo(b.debugName); } ); - return sortedKeys.map((LogicalKeyboardKey key) => '${key.debugName}').join(' + '); + return sortedKeys.map((LogicalKeyboardKey key) => key.debugName.toString()).join(' + '); } @override diff --git a/packages/flutter/test/material/slider_theme_test.dart b/packages/flutter/test/material/slider_theme_test.dart index e474a406653..7c71c25679a 100644 --- a/packages/flutter/test/material/slider_theme_test.dart +++ b/packages/flutter/test/material/slider_theme_test.dart @@ -378,7 +378,7 @@ void main() { data: sliderTheme, child: Slider( value: sliderValue, - label: '$value', + label: value, divisions: 3, onChanged: (double d) { }, ), diff --git a/packages/flutter/test/widgets/semantics_tester.dart b/packages/flutter/test/widgets/semantics_tester.dart index dc3d2e71ee4..fd66cf7aeaf 100644 --- a/packages/flutter/test/widgets/semantics_tester.dart +++ b/packages/flutter/test/widgets/semantics_tester.dart @@ -259,7 +259,7 @@ class TestSemantics { DebugSemanticsDumpOrder childOrder = DebugSemanticsDumpOrder.inverseHitTest, }) { bool fail(String message) { - matchState[TestSemantics] = '$message'; + matchState[TestSemantics] = message; return false; } diff --git a/packages/flutter_localizations/test/material/date_picker_test.dart b/packages/flutter_localizations/test/material/date_picker_test.dart index 3563f174555..3b54198e0d7 100644 --- a/packages/flutter_localizations/test/material/date_picker_test.dart +++ b/packages/flutter_localizations/test/material/date_picker_test.dart @@ -46,7 +46,7 @@ void main() { const Locale('ar', 'AR'): { 'textDirection': TextDirection.rtl, 'expectedDaysOfWeek': ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], - 'expectedDaysOfMonth': List.generate(30, (int i) => '${arabicNumbers.format(i + 1)}'), + 'expectedDaysOfMonth': List.generate(30, (int i) => arabicNumbers.format(i + 1)), 'expectedMonthYearHeader': 'سبتمبر ٢٠١٧', }, }; diff --git a/packages/flutter_test/lib/src/test_async_utils.dart b/packages/flutter_test/lib/src/test_async_utils.dart index cd99756cb91..219497df622 100644 --- a/packages/flutter_test/lib/src/test_async_utils.dart +++ b/packages/flutter_test/lib/src/test_async_utils.dart @@ -344,14 +344,14 @@ class TestAsyncUtils { // a 'dart:' API, like from the Future/microtask mechanism, because dart: URLs in the // stack trace don't have a column number and so don't match the regexp above. information.add(ErrorSummary('(Unable to parse the stack frame of the method that called the method that called $_className.$method(). The stack may be incomplete or bogus.)')); - information.add(ErrorDescription('${stack[index]}')); + information.add(ErrorDescription(stack[index])); } } else { information.add(ErrorSummary('(Unable to find the stack frame of the method that called the method that called $_className.$method(). The stack may be incomplete or bogus.)')); } } else { information.add(ErrorSummary('(Unable to parse the stack frame of the method that called $_className.$method(). The stack may be incomplete or bogus.)')); - information.add(ErrorDescription('${stack[index]}')); + information.add(ErrorDescription(stack[index])); } } else { information.add(ErrorSummary('(Unable to find the method that called $_className.$method(). The stack may be incomplete or bogus.)')); diff --git a/packages/flutter_tools/lib/src/android/android_studio.dart b/packages/flutter_tools/lib/src/android/android_studio.dart index f7ebfb42877..65cb3e9e3c5 100644 --- a/packages/flutter_tools/lib/src/android/android_studio.dart +++ b/packages/flutter_tools/lib/src/android/android_studio.dart @@ -68,7 +68,7 @@ class AndroidStudio implements Comparable { } final String presetPluginsPath = pathsSelectorValue == null ? null - : globals.fs.path.join(homeDirPath, 'Library', 'Application Support', '$pathsSelectorValue'); + : globals.fs.path.join(homeDirPath, 'Library', 'Application Support', pathsSelectorValue); return AndroidStudio(studioPath, version: version, presetPluginsPath: presetPluginsPath); } diff --git a/packages/flutter_tools/lib/src/build_runner/web_fs.dart b/packages/flutter_tools/lib/src/build_runner/web_fs.dart index aee81c6c57c..747291a5a73 100644 --- a/packages/flutter_tools/lib/src/build_runner/web_fs.dart +++ b/packages/flutter_tools/lib/src/build_runner/web_fs.dart @@ -451,7 +451,7 @@ class DebugAssetServer extends AssetServer { flutterProject.dartTool.path, 'build', 'flutter_web', - '${flutterProject.manifest.appName}', + flutterProject.manifest.appName, 'lib', '${targetBaseName}_web_entrypoint.dart.js.tar.gz', )); diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart index c39411cec99..4d3b5fa72ff 100644 --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart @@ -580,7 +580,7 @@ abstract class CachedArtifact extends ArtifactSet { /// Download an archive from the given [url] and unzip it to [location]. Future _downloadArchive(String message, Uri url, Directory location, bool verifier(File f), void extractor(File f, Directory d)) { - return _withDownloadFile('${flattenNameSubdirs(url)}', (File tempFile) async { + return _withDownloadFile(flattenNameSubdirs(url), (File tempFile) async { if (!verifier(tempFile)) { final Status status = globals.logger.startProgress(message, timeout: timeoutConfiguration.slowOperation); try { diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart index 9b3a170529a..30d01e4b25a 100644 --- a/packages/flutter_tools/lib/src/commands/update_packages.dart +++ b/packages/flutter_tools/lib/src/commands/update_packages.dart @@ -382,7 +382,7 @@ class UpdatePackagesCommand extends FlutterCommand { for (_DependencyLink path in paths) { final StringBuffer buf = StringBuffer(); while (path != null) { - buf.write('${path.to}'); + buf.write(path.to); path = path.from; if (path != null) { buf.write(' <- '); diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index cbd4dd46891..c00182118ad 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -605,8 +605,9 @@ class DefaultResidentCompiler implements ResidentCompiler { _server.stdin.writeln('recompile $mainUri$inputKey'); globals.printTrace('<- recompile $mainUri$inputKey'); for (final Uri fileUri in request.invalidatedFiles) { - _server.stdin.writeln(_mapFileUri(fileUri.toString(), packageUriMapper)); - globals.printTrace('${_mapFileUri(fileUri.toString(), packageUriMapper)}'); + final String message = _mapFileUri(fileUri.toString(), packageUriMapper); + _server.stdin.writeln(message); + globals.printTrace(message); } _server.stdin.writeln(inputKey); globals.printTrace('<- $inputKey'); diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index debd75a5b5c..b1805b961e1 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -468,7 +468,7 @@ abstract class Device { table.add([ device.name, device.id, - '${getNameForTargetPlatform(targetPlatform)}', + getNameForTargetPlatform(targetPlatform), '${await device.sdkNameAndVersion}$supportIndicator', ]); } diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart index 30e368b21fb..4d59ca5ca67 100644 --- a/packages/flutter_tools/lib/src/ios/devices.dart +++ b/packages/flutter_tools/lib/src/ios/devices.dart @@ -50,7 +50,7 @@ class IOSDeploy { '--justlaunch', if (launchArguments.isNotEmpty) ...[ '--args', - '${launchArguments.join(" ")}', + launchArguments.join(' '), ], ]; diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart index 40ddcd9bc66..e35de71071f 100644 --- a/packages/flutter_tools/lib/src/ios/mac.dart +++ b/packages/flutter_tools/lib/src/ios/mac.dart @@ -469,7 +469,7 @@ Future buildXcodeProject({ initialBuildStatus = null; globals.printStatus( 'Xcode build done.'.padRight(kDefaultStatusPadding + 1) - + '${getElapsedAsSeconds(sw.elapsed).padLeft(5)}', + + getElapsedAsSeconds(sw.elapsed).padLeft(5), ); flutterUsage.sendTiming('build', 'xcode-ios', Duration(milliseconds: sw.elapsedMilliseconds)); diff --git a/packages/flutter_tools/lib/src/macos/build_macos.dart b/packages/flutter_tools/lib/src/macos/build_macos.dart index a18fd1b2a8b..0e560ee7447 100644 --- a/packages/flutter_tools/lib/src/macos/build_macos.dart +++ b/packages/flutter_tools/lib/src/macos/build_macos.dart @@ -79,7 +79,7 @@ Future buildMacOS({ 'xcrun', 'xcodebuild', '-workspace', flutterProject.macos.xcodeWorkspace.path, - '-configuration', '$configuration', + '-configuration', configuration, '-scheme', 'Runner', '-derivedDataPath', flutterBuildDir.absolute.path, 'OBJROOT=${globals.fs.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}', diff --git a/packages/flutter_tools/lib/src/reporting/events.dart b/packages/flutter_tools/lib/src/reporting/events.dart index 626629c4b66..3bf813905fc 100644 --- a/packages/flutter_tools/lib/src/reporting/events.dart +++ b/packages/flutter_tools/lib/src/reporting/events.dart @@ -139,9 +139,9 @@ class BuildEvent extends UsageEvent { // category 'build', // parameter - FlutterCommand.current == null ? - 'unspecified' : - '${FlutterCommand.current.name}', + FlutterCommand.current == null + ? 'unspecified' + : FlutterCommand.current.name, label: label, ); diff --git a/packages/flutter_tools/lib/src/test/test_compiler.dart b/packages/flutter_tools/lib/src/test/test_compiler.dart index 30e90970c9e..a876544c026 100644 --- a/packages/flutter_tools/lib/src/test/test_compiler.dart +++ b/packages/flutter_tools/lib/src/test/test_compiler.dart @@ -186,6 +186,6 @@ class TestCompiler { _suppressOutput = true; return; } - globals.printError('$message'); + globals.printError(message); } } diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart index 9daa2c56d1e..f7d7912f659 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart @@ -115,7 +115,7 @@ void main() { }); await const DebugUnpackMacOS().build(environment); - expect(globals.fs.directory('$_kOutputPrefix').existsSync(), true); + expect(globals.fs.directory(_kOutputPrefix).existsSync(), true); for (final File file in inputs) { expect(globals.fs.file(file.path.replaceFirst(_kInputPrefix, _kOutputPrefix)).existsSync(), true); } diff --git a/packages/flutter_tools/test/general.shard/runner/flutter_command_runner_test.dart b/packages/flutter_tools/test/general.shard/runner/flutter_command_runner_test.dart index a5a6460f7ac..bb6104f2d4b 100644 --- a/packages/flutter_tools/test/general.shard/runner/flutter_command_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/runner/flutter_command_runner_test.dart @@ -107,7 +107,7 @@ void main() { await runner.run(['dummy', '--local-engine=ios_debug']); // Verify that this also works if the sky_engine path is a symlink to the engine root. - fs.link('/symlink').createSync('$_kArbitraryEngineRoot'); + fs.link('/symlink').createSync(_kArbitraryEngineRoot); fs.file(_kDotPackages).writeAsStringSync('sky_engine:file:///symlink/src/out/ios_debug/gen/dart-pkg/sky_engine/lib/'); await runner.run(['dummy', '--local-engine=ios_debug']); }, overrides: {