diff --git a/analysis_options.yaml b/analysis_options.yaml index 373d55e3b9..ae7e109c44 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -169,7 +169,7 @@ linter: - prefer_initializing_formals - prefer_inlined_adds # - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants - # - prefer_interpolation_to_compose_strings # doesn't work with raw strings, see https://github.com/dart-lang/linter/issues/2490 + - prefer_interpolation_to_compose_strings - prefer_is_empty - prefer_is_not_empty - prefer_is_not_operator diff --git a/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart b/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart index a5fe1f3350..ee9d3793ea 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/picture_cache.dart @@ -213,9 +213,9 @@ class ListItem extends StatelessWidget { if (count < 10000) { return count.toString(); } else if (count < 100000) { - return (count / 10000).toStringAsPrecision(2) + 'w'; + return '${(count / 10000).toStringAsPrecision(2)}w'; } else { - return (count / 10000).floor().toString() + 'w'; + return '${(count / 10000).floor()}w'; } } diff --git a/dev/benchmarks/test_apps/stocks/lib/stock_row.dart b/dev/benchmarks/test_apps/stocks/lib/stock_row.dart index 8d1fce19cd..8b94c7283c 100644 --- a/dev/benchmarks/test_apps/stocks/lib/stock_row.dart +++ b/dev/benchmarks/test_apps/stocks/lib/stock_row.dart @@ -33,7 +33,7 @@ class StockRow extends StatelessWidget { final String lastSale = '\$${stock.lastSale.toStringAsFixed(2)}'; String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%'; if (stock.percentChange > 0) - changeInPrice = '+' + changeInPrice; + changeInPrice = '+$changeInPrice'; return InkWell( key: ValueKey(stock.symbol), onTap: _getHandler(onPressed), 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 d546550928..ac7ecc9795 100644 --- a/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart +++ b/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart @@ -22,7 +22,7 @@ class _StockSymbolView extends StatelessWidget { final String lastSale = '\$${stock.lastSale.toStringAsFixed(2)}'; String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%'; if (stock.percentChange > 0) - changeInPrice = '+' + changeInPrice; + changeInPrice = '+$changeInPrice'; final TextStyle headings = Theme.of(context).textTheme.bodyText1!; return Container( diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index 429b9b37b6..ed8f93f084 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -243,8 +243,8 @@ Future verifyNoMissingLicense(String workingDirectory, { bool checkMinimum await _verifyNoMissingLicenseForExtension(workingDirectory, 'swift', overrideMinimumMatches ?? 10, _generateLicense('// ')); await _verifyNoMissingLicenseForExtension(workingDirectory, 'gradle', overrideMinimumMatches ?? 80, _generateLicense('// ')); await _verifyNoMissingLicenseForExtension(workingDirectory, 'gn', overrideMinimumMatches ?? 0, _generateLicense('# ')); - await _verifyNoMissingLicenseForExtension(workingDirectory, 'sh', overrideMinimumMatches ?? 1, '#!/usr/bin/env bash\n' + _generateLicense('# ')); - await _verifyNoMissingLicenseForExtension(workingDirectory, 'bat', overrideMinimumMatches ?? 1, '@ECHO off\n' + _generateLicense('REM ')); + await _verifyNoMissingLicenseForExtension(workingDirectory, 'sh', overrideMinimumMatches ?? 1, '#!/usr/bin/env bash\n${_generateLicense('# ')}'); + await _verifyNoMissingLicenseForExtension(workingDirectory, 'bat', overrideMinimumMatches ?? 1, '@ECHO off\n${_generateLicense('REM ')}'); await _verifyNoMissingLicenseForExtension(workingDirectory, 'ps1', overrideMinimumMatches ?? 1, _generateLicense('# ')); await _verifyNoMissingLicenseForExtension(workingDirectory, 'html', overrideMinimumMatches ?? 1, '\n', trailingBlank: false); await _verifyNoMissingLicenseForExtension(workingDirectory, 'xml', overrideMinimumMatches ?? 1, ''); @@ -252,7 +252,7 @@ Future verifyNoMissingLicense(String workingDirectory, { bool checkMinimum Future _verifyNoMissingLicenseForExtension(String workingDirectory, String extension, int minimumMatches, String license, { bool trailingBlank = true }) async { assert(!license.endsWith('\n')); - final String licensePattern = license + '\n' + (trailingBlank ? '\n' : ''); + final String licensePattern = '$license\n${trailingBlank ? '\n' : ''}'; final List errors = []; await for (final File file in _allFiles(workingDirectory, extension, minimumMatches: minimumMatches)) { final String contents = file.readAsStringSync().replaceAll('\r\n', '\n'); @@ -317,13 +317,13 @@ Future verifyNoBadImportsInFlutter(String workingDirectory) async { .map((Directory entity) => path.basename(entity.path)) .toList()..sort(); if (!_listEquals(packages, directories)) { - errors.add( - 'flutter/lib/*.dart does not match flutter/lib/src/*/:\n' - 'These are the exported packages:\n' + - packages.map((String path) => ' lib/$path.dart').join('\n') + - 'These are the directories:\n' + - directories.map((String path) => ' lib/src/$path/').join('\n') - ); + errors.add([ + 'flutter/lib/*.dart does not match flutter/lib/src/*/:', + 'These are the exported packages:', + ...packages.map((String path) => ' lib/$path.dart'), + 'These are the directories:', + ...directories.map((String path) => ' lib/src/$path/') + ].join('\n')); } // Verify that the imports are well-ordered. final Map> dependencyMap = >{}; @@ -347,7 +347,7 @@ Future verifyNoBadImportsInFlutter(String workingDirectory) async { continue; // Sanity check before performing _deepSearch, to ensure there's no rogue // dependencies. - final String validFilenames = dependencyMap.keys.map((String name) => name + '.dart').join(', '); + final String validFilenames = dependencyMap.keys.map((String name) => '$name.dart').join(', '); errors.add( '$key imported package:flutter/$dependency.dart ' 'which is not one of the valid exports { $validFilenames }.\n' @@ -359,10 +359,7 @@ Future verifyNoBadImportsInFlutter(String workingDirectory) async { for (final String package in dependencyMap.keys) { final List loop = _deepSearch(dependencyMap, package); if (loop != null) { - errors.add( - '${yellow}Dependency loop:$reset ' + - loop.join(' depends on ') - ); + errors.add('${yellow}Dependency loop:$reset ${loop.join(' depends on ')}'); } } // Fail if any errors diff --git a/dev/bots/test.dart b/dev/bots/test.dart index f02426c960..49248d6933 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -636,7 +636,7 @@ Future _runFrameworkTests() async { await _runFlutterTest( path.join(flutterRoot, 'packages', 'flutter'), options: ['--dart-define=dart.vm.product=true', ...soundNullSafetyOptions], - tests: [ 'test_release' + path.separator ], + tests: ['test_release${path.separator}'], ); } diff --git a/dev/bots/test/analyze_test.dart b/dev/bots/test/analyze_test.dart index 52f88d2173..1bffc6cade 100644 --- a/dev/bots/test/analyze_test.dart +++ b/dev/bots/test/analyze_test.dart @@ -41,28 +41,31 @@ void main() { test('analyze.dart - verifyDeprecations', () async { final String result = await capture(() => verifyDeprecations(testRootPath, minimumMatches: 2), exitCode: 1); + final String lines = [ + 'test/analyze-test-input/root/packages/foo/deprecation.dart:12: Deprecation notice does not match required pattern.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:18: Deprecation notice should be a grammatically correct sentence and start with a capital letter; see style guide: STYLE_GUIDE_URL', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:25: Deprecation notice should be a grammatically correct sentence and end with a period.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:29: Deprecation notice does not match required pattern.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:32: Deprecation notice does not match required pattern.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:37: Deprecation notice does not match required pattern.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:41: Deprecation notice does not match required pattern.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:48: End of deprecation notice does not match required pattern.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:51: Unexpected deprecation notice indent.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:70: Deprecation notice does not accurately indicate a dev branch version number; please see RELEASES_URL to find the latest dev build version number.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:76: Deprecation notice does not accurately indicate a dev branch version number; please see RELEASES_URL to find the latest dev build version number.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:82: Deprecation notice does not accurately indicate a dev branch version number; please see RELEASES_URL to find the latest dev build version number.', + 'test/analyze-test-input/root/packages/foo/deprecation.dart:99: Deprecation notice does not match required pattern. You might have used double quotes (") for the string instead of single quotes (\').', + ] + .map((String line) { + return line + .replaceAll('/', Platform.isWindows ? r'\' : '/') + .replaceAll('STYLE_GUIDE_URL', 'https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo') + .replaceAll('RELEASES_URL', 'https://flutter.dev/docs/development/tools/sdk/releases'); + }) + .join('\n'); expect(result, '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' - + - ( - 'test/analyze-test-input/root/packages/foo/deprecation.dart:12: Deprecation notice does not match required pattern.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:18: Deprecation notice should be a grammatically correct sentence and start with a capital letter; see style guide: STYLE_GUIDE_URL\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:25: Deprecation notice should be a grammatically correct sentence and end with a period.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:29: Deprecation notice does not match required pattern.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:32: Deprecation notice does not match required pattern.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:37: Deprecation notice does not match required pattern.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:41: Deprecation notice does not match required pattern.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:48: End of deprecation notice does not match required pattern.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:51: Unexpected deprecation notice indent.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:70: Deprecation notice does not accurately indicate a dev branch version number; please see RELEASES_URL to find the latest dev build version number.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:76: Deprecation notice does not accurately indicate a dev branch version number; please see RELEASES_URL to find the latest dev build version number.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:82: Deprecation notice does not accurately indicate a dev branch version number; please see RELEASES_URL to find the latest dev build version number.\n' - 'test/analyze-test-input/root/packages/foo/deprecation.dart:99: Deprecation notice does not match required pattern. You might have used double quotes (") for the string instead of single quotes (\').\n' - .replaceAll('/', Platform.isWindows ? r'\' : '/') - .replaceAll('STYLE_GUIDE_URL', 'https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo') - .replaceAll('RELEASES_URL', 'https://flutter.dev/docs/development/tools/sdk/releases') - ) - + + '$lines\n' 'See: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes\n' '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' ); @@ -70,15 +73,12 @@ void main() { test('analyze.dart - verifyNoMissingLicense', () async { final String result = await capture(() => verifyNoMissingLicense(testRootPath, checkMinimums: false), exitCode: 1); + final String lines = 'test/analyze-test-input/root/packages/foo/foo.dart' + .replaceAll('/', Platform.isWindows ? r'\' : '/'); expect(result, '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' - + - ( - 'The following 1 file does not have the right license header:\n' - 'test/analyze-test-input/root/packages/foo/foo.dart\n' - .replaceAll('/', Platform.isWindows ? r'\' : '/') - ) - + + 'The following 1 file does not have the right license header:\n' + '$lines\n' 'The expected license header is:\n' '// Copyright 2014 The Flutter Authors. All rights reserved.\n' '// Use of this source code is governed by a BSD-style license that can be\n' @@ -90,15 +90,15 @@ void main() { test('analyze.dart - verifyNoTrailingSpaces', () async { final String result = await capture(() => verifyNoTrailingSpaces(testRootPath, minimumMatches: 2), exitCode: 1); + final String lines = [ + 'test/analyze-test-input/root/packages/foo/spaces.txt:5: trailing U+0020 space character', + 'test/analyze-test-input/root/packages/foo/spaces.txt:9: trailing blank line', + ] + .map((String line) => line.replaceAll('/', Platform.isWindows ? r'\' : '/')) + .join('\n'); expect(result, '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' - + - ( - 'test/analyze-test-input/root/packages/foo/spaces.txt:5: trailing U+0020 space character\n' - 'test/analyze-test-input/root/packages/foo/spaces.txt:9: trailing blank line\n' - .replaceAll('/', Platform.isWindows ? r'\' : '/') - ) - + + '$lines\n' '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' ); }); diff --git a/dev/devicelab/bin/tasks/plugin_lint_mac.dart b/dev/devicelab/bin/tasks/plugin_lint_mac.dart index dbef483f59..b682383ce0 100644 --- a/dev/devicelab/bin/tasks/plugin_lint_mac.dart +++ b/dev/devicelab/bin/tasks/plugin_lint_mac.dart @@ -224,7 +224,7 @@ Future main() async { section('Build Objective-C application with Swift and Objective-C plugins as frameworks'); - objcPodfileContent = 'use_frameworks!\n' + objcPodfileContent; + objcPodfileContent = 'use_frameworks!\n$objcPodfileContent'; objcPodfile.writeAsStringSync(objcPodfileContent, flush: true); await inDirectory(objcAppPath, () async { diff --git a/dev/devicelab/lib/framework/apk_utils.dart b/dev/devicelab/lib/framework/apk_utils.dart index c1d148d65c..c8d8e924e6 100644 --- a/dev/devicelab/lib/framework/apk_utils.dart +++ b/dev/devicelab/lib/framework/apk_utils.dart @@ -445,7 +445,7 @@ Future _resultOfGradleTask({String workingDirectory, String task, ]; final String gradle = path.join(workingDirectory, Platform.isWindows ? 'gradlew.bat' : './gradlew'); print('┌── $gradle'); - print('│ ' + File(path.join(workingDirectory, gradle)).readAsLinesSync().join('\n│ ')); + print(File(path.join(workingDirectory, gradle)).readAsLinesSync().map((String line) => '| $line').join('\n')); print('└─────────────────────────────────────────────────────────────────────────────────────'); print( 'Running Gradle:\n' diff --git a/dev/devicelab/lib/framework/cocoon.dart b/dev/devicelab/lib/framework/cocoon.dart index 749c39d8d0..d4959c29bc 100644 --- a/dev/devicelab/lib/framework/cocoon.dart +++ b/dev/devicelab/lib/framework/cocoon.dart @@ -126,7 +126,7 @@ class Cocoon { if (resultFile.existsSync()) { resultFile.deleteSync(); } - logger.fine('Writing results: ' + json.encode(updateRequest)); + logger.fine('Writing results: ${json.encode(updateRequest)}'); resultFile.createSync(); resultFile.writeAsStringSync(json.encode(updateRequest)); } diff --git a/dev/devicelab/lib/framework/running_processes.dart b/dev/devicelab/lib/framework/running_processes.dart index 0be5180014..b0b2ce0697 100644 --- a/dev/devicelab/lib/framework/running_processes.dart +++ b/dev/devicelab/lib/framework/running_processes.dart @@ -148,7 +148,7 @@ Iterable processPowershellOutput(String output) sync* { rawTime = '0$rawTime'; } if (rawTime[4] == '/') { - rawTime = rawTime.substring(0, 3) + '0' + rawTime.substring(3); + rawTime = '${rawTime.substring(0, 3)}0${rawTime.substring(3)}'; } final String year = rawTime.substring(6, 10); final String month = rawTime.substring(3, 5); diff --git a/dev/devicelab/lib/framework/utils.dart b/dev/devicelab/lib/framework/utils.dart index 7ba1349206..05ee37c3f5 100644 --- a/dev/devicelab/lib/framework/utils.dart +++ b/dev/devicelab/lib/framework/utils.dart @@ -564,7 +564,8 @@ T requireConfigProperty(Map map, String propertyName) { } String jsonEncode(dynamic data) { - return const JsonEncoder.withIndent(' ').convert(data) + '\n'; + final String jsonValue = const JsonEncoder.withIndent(' ').convert(data); + return '$jsonValue\n'; } Future getNewGallery(String revision, Directory galleryDir) async { diff --git a/dev/devicelab/lib/tasks/hot_mode_tests.dart b/dev/devicelab/lib/tasks/hot_mode_tests.dart index 8e478de141..bc33b3ab1c 100644 --- a/dev/devicelab/lib/tasks/hot_mode_tests.dart +++ b/dev/devicelab/lib/tasks/hot_mode_tests.dart @@ -95,7 +95,7 @@ TaskFunction createHotModeTest({String deviceIdOverride, Map env if (hotReloadCount == 2) { // Trigger a framework invalidation (370 libraries) without modifying the source flutterFrameworkSource.writeAsStringSync( - flutterFrameworkSource.readAsStringSync() + '\n' + '${flutterFrameworkSource.readAsStringSync()}\n' ); process.stdin.writeln('r'); hotReloadCount += 1; diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart index 7630fed8a5..da4fb9a2a0 100644 --- a/dev/devicelab/lib/tasks/perf_tests.dart +++ b/dev/devicelab/lib/tasks/perf_tests.dart @@ -1004,7 +1004,7 @@ class WebCompileTest { sizeMetrics['${metric}_dart2js_size'] = _parseDu(result.stdout as String); await Process.run('gzip',['-k', '9', fileName]); - final ProcessResult resultGzip = await Process.run('du', ['-k', fileName + '.gz']); + final ProcessResult resultGzip = await Process.run('du', ['-k', '$fileName.gz']); sizeMetrics['${metric}_dart2js_size_gzip'] = _parseDu(resultGzip.stdout as String); return sizeMetrics; diff --git a/dev/devicelab/test/cocoon_test.dart b/dev/devicelab/test/cocoon_test.dart index 03c93537c6..460b05585a 100644 --- a/dev/devicelab/test/cocoon_test.dart +++ b/dev/devicelab/test/cocoon_test.dart @@ -217,7 +217,7 @@ void main() { test('reads token from service account file with whitespace', () { final File serviceAccountFile = fs.file(serviceAccountTokenPath)..createSync(); - serviceAccountFile.writeAsStringSync(serviceAccountToken + ' \n'); + serviceAccountFile.writeAsStringSync('$serviceAccountToken \n'); final AuthenticatedCocoonClient client = AuthenticatedCocoonClient(serviceAccountTokenPath, filesystem: fs); expect(client.serviceAccountToken, serviceAccountToken); }); diff --git a/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart b/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart index 9f832a6e50..e92a765d1c 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart @@ -36,9 +36,9 @@ class FloatToken extends NumberToken { static double _parse(String stringRep) { String toParse = stringRep; if (toParse.startsWith('.')) - toParse = '0' + toParse; + toParse = '0$toParse'; if (toParse.endsWith('.')) - toParse = toParse + '0'; + toParse = '${toParse}0'; return double.parse(toParse); } } @@ -189,7 +189,8 @@ class CalcExpression { case ExpressionState.LeadingNeg: case ExpressionState.Number: final ExpressionToken last = outList.removeLast()!; - newToken = FloatToken(last.stringRep! + '.'); + final String value = last.stringRep!; + newToken = FloatToken('$value.'); break; case ExpressionState.Point: case ExpressionState.NumberWithPoint: diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart index 8bd8481537..5b1723907a 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart @@ -220,7 +220,8 @@ class _ChipDemoState extends State { if (_selectedAction.isEmpty) { return ''; } - return _capitalize(_results[_selectedAction]!) + '!'; + final String value = _capitalize(_results[_selectedAction]!); + return '$value!'; } @override diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart index 2f5dc6a237..395e81cb5b 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart @@ -317,17 +317,20 @@ class _UsNumberTextInputFormatter extends TextInputFormatter { selectionIndex++; } if (newTextLength >= 4) { - newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); + final String value = newValue.text.substring(0, usedSubstringIndex = 3); + newText.write('$value) '); if (newValue.selection.end >= 3) selectionIndex += 2; } if (newTextLength >= 7) { - newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); + final String value = newValue.text.substring(3, usedSubstringIndex = 6); + newText.write('$value-'); if (newValue.selection.end >= 6) selectionIndex++; } if (newTextLength >= 11) { - newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); + final String value = newValue.text.substring(6, usedSubstringIndex = 10); + newText.write('$value '); if (newValue.selection.end >= 10) selectionIndex++; } diff --git a/dev/manual_tests/lib/text.dart b/dev/manual_tests/lib/text.dart index 82a6d33eac..6facdf210c 100644 --- a/dev/manual_tests/lib/text.dart +++ b/dev/manual_tests/lib/text.dart @@ -457,7 +457,8 @@ class _FuzzerState extends State with SingleTickerProviderStateMixin { case 65: // random emoji return String.fromCharCode(0x1F000 + _random.nextInt(0x9FF)); case 66: - return 'Z{' + zalgo(_random, _random.nextInt(4) + 2) + '}Z'; + final String value = zalgo(_random, _random.nextInt(4) + 2); + return 'Z{$value}Z'; case 67: return 'Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν'; case 68: @@ -963,7 +964,10 @@ class _PaintingState extends State with SingleTickerProviderStateMixin if (mounted && intrinsicKey.currentContext?.size?.height != controlKey.currentContext?.size?.height) { debugPrint('Found some text that unexpectedly renders at different heights.'); debugPrint('Text: $_text'); - debugPrint(_text?.runes.map((int index) => 'U+' + index.toRadixString(16).padLeft(4, '0')).join(' ')); + debugPrint(_text?.runes.map((int index) { + final String hexa = index.toRadixString(16).padLeft(4, '0'); + return 'U+$hexa'; + }).join(' ')); setState(() { _ticker.stop(); }); diff --git a/dev/tools/gen_keycodes/bin/gen_keycodes.dart b/dev/tools/gen_keycodes/bin/gen_keycodes.dart index 4c1d3aecc5..eae21aefed 100644 --- a/dev/tools/gen_keycodes/bin/gen_keycodes.dart +++ b/dev/tools/gen_keycodes/bin/gen_keycodes.dart @@ -185,8 +185,10 @@ Future main(List rawArguments) async { // Write data files const JsonEncoder encoder = JsonEncoder.withIndent(' '); - File(parsedArguments['physical-data'] as String).writeAsStringSync(encoder.convert(physicalData.toJson()) + '\n'); - File(parsedArguments['logical-data'] as String).writeAsStringSync(encoder.convert(logicalData.toJson()) + '\n'); + final String physicalJson = encoder.convert(physicalData.toJson()); + File(parsedArguments['physical-data'] as String).writeAsStringSync('$physicalJson\n'); + final String logicalJson = encoder.convert(logicalData.toJson()); + File(parsedArguments['logical-data'] as String).writeAsStringSync('$logicalJson\n'); } else { physicalData = PhysicalKeyData.fromJson(json.decode(await File(parsedArguments['physical-data'] as String).readAsString()) as Map); logicalData = LogicalKeyData.fromJson(json.decode(await File(parsedArguments['logical-data'] as String).readAsString()) as Map); diff --git a/dev/tools/java_and_objc_doc.dart b/dev/tools/java_and_objc_doc.dart index 21fbd7faae..2cdaefba34 100644 --- a/dev/tools/java_and_objc_doc.dart +++ b/dev/tools/java_and_objc_doc.dart @@ -37,7 +37,7 @@ Future fetchArchive(String url, int maxTries) async { // On failure print a short snipped from the body in case it's helpful. final int bodyLength = min(1024, response.body.length); - stderr.writeln('Response status code ${response.statusCode}. Body: ' + response.body.substring(0, bodyLength)); + stderr.writeln('Response status code ${response.statusCode}. Body: ${response.body.substring(0, bodyLength)}'); sleep(const Duration(seconds: 1)); } return responseBytes == null ? null : ZipDecoder().decodeBytes(responseBytes); diff --git a/dev/tools/localization/bin/gen_localizations.dart b/dev/tools/localization/bin/gen_localizations.dart index faa4899b4a..45db77e29b 100644 --- a/dev/tools/localization/bin/gen_localizations.dart +++ b/dev/tools/localization/bin/gen_localizations.dart @@ -95,7 +95,7 @@ String generateArbBasedLocalizationSubclasses({ languageToScriptCodes[locale.languageCode].add(locale.scriptCode); } if (locale.countryCode != null && locale.scriptCode != null) { - final LocaleInfo key = LocaleInfo.fromString(locale.languageCode + '_' + locale.scriptCode); + final LocaleInfo key = LocaleInfo.fromString('${locale.languageCode}_${locale.scriptCode}'); languageAndScriptToCountryCodes[key] ??= {}; languageAndScriptToCountryCodes[key].add(locale.countryCode); } @@ -150,7 +150,7 @@ String generateArbBasedLocalizationSubclasses({ // Language has scriptCodes, so we need to properly fallback countries to corresponding // script default values before language default values. for (final String scriptCode in languageToScriptCodes[languageName]) { - final LocaleInfo scriptBaseLocale = LocaleInfo.fromString(languageName + '_' + scriptCode); + final LocaleInfo scriptBaseLocale = LocaleInfo.fromString('${languageName}_$scriptCode'); output.writeln(generateClassDeclaration( scriptBaseLocale, generatedClassPrefix, @@ -170,7 +170,7 @@ String generateArbBasedLocalizationSubclasses({ for (final LocaleInfo locale in localeCodes) { if (locale.originalString == languageName) continue; - if (locale.originalString == languageName + '_' + scriptCode) + if (locale.originalString == '${languageName}_$scriptCode') continue; if (locale.scriptCode != scriptCode) continue; @@ -217,12 +217,12 @@ String generateArbBasedLocalizationSubclasses({ } } - final String scriptCodeMessage = scriptCodeCount == 0 ? '' : ' and $scriptCodeCount script' + (scriptCodeCount == 1 ? '' : 's'); + final String scriptCodeMessage = scriptCodeCount == 0 ? '' : ' and $scriptCodeCount script${scriptCodeCount == 1 ? '' : 's'}'; if (countryCodeCount == 0) { if (scriptCodeCount == 0) supportedLocales.writeln('/// * `$languageName` - ${describeLocale(languageName)}'); else - supportedLocales.writeln('/// * `$languageName` - ${describeLocale(languageName)} (plus $scriptCodeCount script' + (scriptCodeCount == 1 ? '' : 's') + ')'); + supportedLocales.writeln('/// * `$languageName` - ${describeLocale(languageName)} (plus $scriptCodeCount script${scriptCodeCount == 1 ? '' : 's'})'); } else if (countryCodeCount == 1) { supportedLocales.writeln('/// * `$languageName` - ${describeLocale(languageName)} (plus one country variation$scriptCodeMessage)'); @@ -295,7 +295,7 @@ $factoryDeclaration case '$language': { switch (locale.scriptCode) {'''); for (final String scriptCode in languageToScriptCodes[language]) { - final LocaleInfo scriptLocale = LocaleInfo.fromString(language + '_' + scriptCode); + final LocaleInfo scriptLocale = LocaleInfo.fromString('${language}_$scriptCode'); output.writeln(''' case '$scriptCode': {'''); if (languageAndScriptToCountryCodes.containsKey(scriptLocale)) { @@ -458,7 +458,7 @@ String generateValue(String value, Map attributes, LocaleInfo l throw Exception( '"$value" is not one of the ICU short time patterns supported ' 'by the material library. Here is the list of supported ' - 'patterns:\n ' + _icuTimeOfDayToEnum.keys.join('\n ') + 'patterns:\n ${_icuTimeOfDayToEnum.keys.join('\n ')}' ); } return _icuTimeOfDayToEnum[value]; @@ -467,7 +467,7 @@ String generateValue(String value, Map attributes, LocaleInfo l throw Exception( '"$value" is not one of the scriptCategory values supported ' 'by the material library. Here is the list of supported ' - 'values:\n ' + _scriptCategoryToEnum.keys.join('\n ') + 'values:\n ${_scriptCategoryToEnum.keys.join('\n ')}' ); } return _scriptCategoryToEnum[value]; diff --git a/dev/tools/localization/localizations_utils.dart b/dev/tools/localization/localizations_utils.dart index ae1e4451c9..fbf9bbcb33 100644 --- a/dev/tools/localization/localizations_utils.dart +++ b/dev/tools/localization/localizations_utils.dart @@ -96,9 +96,9 @@ class LocaleInfo implements Comparable { // Update the base string to reflect assumed scriptCodes. originalString = languageCode; if (scriptCode != null) - originalString += '_' + scriptCode; + originalString += '_$scriptCode'; if (countryCode != null) - originalString += '_' + countryCode; + originalString += '_$countryCode'; } return LocaleInfo( @@ -202,7 +202,7 @@ void loadMatchingArbsIntoBundleMaps({ // Add an assumed locale to default to when there is no info on scriptOnly locales. locale = LocaleInfo.fromString(localeString, deriveScriptCode: true); if (locale.scriptCode != null) { - final LocaleInfo scriptLocale = LocaleInfo.fromString(locale.languageCode + '_' + locale.scriptCode); + final LocaleInfo scriptLocale = LocaleInfo.fromString('${locale.languageCode}_${locale.scriptCode}'); if (!localeToResources.containsKey(scriptLocale)) { assumedLocales.add(scriptLocale); localeToResources[scriptLocale] ??= {}; diff --git a/dev/tools/mega_gallery.dart b/dev/tools/mega_gallery.dart index ee7ddce25f..7eead9374b 100644 --- a/dev/tools/mega_gallery.dart +++ b/dev/tools/mega_gallery.dart @@ -192,6 +192,6 @@ int _lineCount(File file) { String _comma(int count) { final String str = count.toString(); if (str.length > 3) - return str.substring(0, str.length - 3) + ',' + str.substring(str.length - 3); + return '${str.substring(0, str.length - 3)},${str.substring(str.length - 3)}'; return str; } diff --git a/examples/layers/widgets/styled_text.dart b/examples/layers/widgets/styled_text.dart index 5da58e9712..2775794bbe 100644 --- a/examples/layers/widgets/styled_text.dart +++ b/examples/layers/widgets/styled_text.dart @@ -55,7 +55,7 @@ Widget toStyledText(String name, String text) { ); } -Widget toPlainText(String name, String text) => Text(name + ':' + text); +Widget toPlainText(String name, String text) => Text('$name:$text'); class SpeakerSeparator extends StatelessWidget { const SpeakerSeparator({Key? key}) : super(key: key); diff --git a/packages/flutter/lib/src/cupertino/localizations.dart b/packages/flutter/lib/src/cupertino/localizations.dart index 4717f8f840..9f8b81c28c 100644 --- a/packages/flutter/lib/src/cupertino/localizations.dart +++ b/packages/flutter/lib/src/cupertino/localizations.dart @@ -344,7 +344,7 @@ class DefaultCupertinoLocalizations implements CupertinoLocalizations { String datePickerHour(int hour) => hour.toString(); @override - String datePickerHourSemanticsLabel(int hour) => hour.toString() + " o'clock"; + String datePickerHourSemanticsLabel(int hour) => "$hour o'clock"; @override String datePickerMinute(int minute) => minute.toString().padLeft(2, '0'); @@ -353,7 +353,7 @@ class DefaultCupertinoLocalizations implements CupertinoLocalizations { String datePickerMinuteSemanticsLabel(int minute) { if (minute == 1) return '1 minute'; - return minute.toString() + ' minutes'; + return '$minute minutes'; } @override diff --git a/packages/flutter/lib/src/foundation/stack_frame.dart b/packages/flutter/lib/src/foundation/stack_frame.dart index a52e6f57c8..f9f630ee61 100644 --- a/packages/flutter/lib/src/foundation/stack_frame.dart +++ b/packages/flutter/lib/src/foundation/stack_frame.dart @@ -121,7 +121,7 @@ class StackFrame { packageScheme = 'package'; final Uri packageUri = Uri.parse(match.group(1)!); package = packageUri.pathSegments[0]; - packagePath = packageUri.path.replaceFirst(packageUri.pathSegments[0] + '/', ''); + packagePath = packageUri.path.replaceFirst('${packageUri.pathSegments[0]}/', ''); } return StackFrame( @@ -232,7 +232,7 @@ class StackFrame { String packagePath = packageUri.path; if (packageUri.scheme == 'dart' || packageUri.scheme == 'package') { package = packageUri.pathSegments[0]; - packagePath = packageUri.path.replaceFirst(packageUri.pathSegments[0] + '/', ''); + packagePath = packageUri.path.replaceFirst('${packageUri.pathSegments[0]}/', ''); } return StackFrame( diff --git a/packages/flutter/lib/src/gestures/recognizer.dart b/packages/flutter/lib/src/gestures/recognizer.dart index f38ca93a9c..b890b89a0b 100644 --- a/packages/flutter/lib/src/gestures/recognizer.dart +++ b/packages/flutter/lib/src/gestures/recognizer.dart @@ -185,7 +185,7 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT final String? report = debugReport != null ? debugReport() : null; // The 19 in the line below is the width of the prefix used by // _debugLogDiagnostic in arena.dart. - final String prefix = debugPrintGestureArenaDiagnostics ? ' ' * 19 + '❙ ' : ''; + final String prefix = debugPrintGestureArenaDiagnostics ? '${' ' * 19}❙ ' : ''; debugPrint('$prefix$this calling $name callback.${ report?.isNotEmpty == true ? " $report" : "" }'); } return true; diff --git a/packages/flutter/lib/src/material/tab_controller.dart b/packages/flutter/lib/src/material/tab_controller.dart index 1f210b0db4..05c3a0153e 100644 --- a/packages/flutter/lib/src/material/tab_controller.dart +++ b/packages/flutter/lib/src/material/tab_controller.dart @@ -122,7 +122,7 @@ import 'constants.dart'; /// children: tabs.map((Tab tab){ /// return Center( /// child: Text( -/// tab.text! + ' Tab', +/// '${tab.text!} Tab', /// style: Theme.of(context).textTheme.headline5, /// ), /// ); diff --git a/packages/flutter/lib/src/painting/alignment.dart b/packages/flutter/lib/src/painting/alignment.dart index 6e7bf58d07..c1562fad3f 100644 --- a/packages/flutter/lib/src/painting/alignment.dart +++ b/packages/flutter/lib/src/painting/alignment.dart @@ -123,7 +123,7 @@ abstract class AlignmentGeometry { return Alignment._stringify(_x, _y); if (_x == 0.0) return AlignmentDirectional._stringify(_start, _y); - return Alignment._stringify(_x, _y) + ' + ' + AlignmentDirectional._stringify(_start, 0.0); + return '${Alignment._stringify(_x, _y)} + ${AlignmentDirectional._stringify(_start, 0.0)}'; } @override diff --git a/packages/flutter/lib/src/services/binding.dart b/packages/flutter/lib/src/services/binding.dart index d0e6bcaf04..1247c3e2e1 100644 --- a/packages/flutter/lib/src/services/binding.dart +++ b/packages/flutter/lib/src/services/binding.dart @@ -153,7 +153,7 @@ mixin ServicesBinding on BindingBase, SchedulerBinding { // This is run in another isolate created by _addLicenses above. static List _parseLicenses(String rawLicenses) { - final String _licenseSeparator = '\n' + ('-' * 80) + '\n'; + final String _licenseSeparator = '\n${'-' * 80}\n'; final List result = []; final List licenses = rawLicenses.split(_licenseSeparator); for (final String license in licenses) { diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index a5220827b1..bc3d294156 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -4479,7 +4479,7 @@ class ErrorWidget extends LeafRenderObjectWidget { static Widget _defaultErrorWidgetBuilder(FlutterErrorDetails details) { String message = ''; assert(() { - message = _stringify(details.exception) + '\nSee also: https://flutter.dev/docs/testing/errors'; + message = '${_stringify(details.exception)}\nSee also: https://flutter.dev/docs/testing/errors'; return true; }()); final Object exception = details.exception; diff --git a/packages/flutter/test/foundation/print_test.dart b/packages/flutter/test/foundation/print_test.dart index 724ebc8314..08691b77f0 100644 --- a/packages/flutter/test/foundation/print_test.dart +++ b/packages/flutter/test/foundation/print_test.dart @@ -43,7 +43,7 @@ void main() { test('debugPrint throttling', () { FakeAsync().run((FakeAsync async) { List log = captureOutput(() { - debugPrintThrottled('A' * (22 * 1024) + '\nB'); + debugPrintThrottled('${'A' * (22 * 1024)}\nB'); }); expect(log.length, 1); async.elapse(const Duration(seconds: 2)); diff --git a/packages/flutter/test/material/dropdown_form_field_test.dart b/packages/flutter/test/material/dropdown_form_field_test.dart index 43c84d35d6..f204887bb0 100644 --- a/packages/flutter/test/material/dropdown_form_field_test.dart +++ b/packages/flutter/test/material/dropdown_form_field_test.dart @@ -70,7 +70,7 @@ Widget buildFormFrame({ return DropdownMenuItem( key: ValueKey(item), value: item, - child: Text(item, key: ValueKey(item + 'Text')), + child: Text(item, key: ValueKey('${item}Text')), ); }).toList(), alignment: buttonAlignment, @@ -292,7 +292,7 @@ void main() { return DropdownMenuItem( key: ValueKey(item), value: item, - child: Text(item, key: ValueKey(item + 'Text')), + child: Text(item, key: ValueKey('${item}Text')), ); }).toList(), ), diff --git a/packages/flutter/test/material/dropdown_test.dart b/packages/flutter/test/material/dropdown_test.dart index 2f0668a053..b4f6257a2c 100644 --- a/packages/flutter/test/material/dropdown_test.dart +++ b/packages/flutter/test/material/dropdown_test.dart @@ -61,7 +61,7 @@ Widget buildDropdown({ return DropdownMenuItem( key: ValueKey(item), value: item, - child: Text(item, key: ValueKey(item + 'Text')), + child: Text(item, key: ValueKey('${item}Text')), ); }).toList(); @@ -230,7 +230,7 @@ class _TestAppState extends State { // The RenderParagraphs should be aligned, i.e. they should have the same // size and location. void checkSelectedItemTextGeometry(WidgetTester tester, String value) { - final List boxes = tester.renderObjectList(find.byKey(ValueKey(value + 'Text'))).toList(); + final List boxes = tester.renderObjectList(find.byKey(ValueKey('${value}Text'))).toList(); expect(boxes.length, equals(2)); final RenderBox box0 = boxes[0]; final RenderBox box1 = boxes[1]; @@ -2470,7 +2470,7 @@ void main() { return DropdownMenuItem( key: ValueKey(item), value: item, - child: Text(item, key: ValueKey(item + 'Text')), + child: Text(item, key: ValueKey('${item}Text')), ); }).toList(), ); @@ -2566,7 +2566,7 @@ void main() { return DropdownMenuItem( key: ValueKey(item), value: item, - child: Text(item, key: ValueKey(item + 'Text')), + child: Text(item, key: ValueKey('${item}Text')), ); }).toList(), ); @@ -2818,7 +2818,7 @@ void main() { return DropdownMenuItem( key: ValueKey(item), value: item, - child: Text(item, key: ValueKey(item + 'Text')), + child: Text(item, key: ValueKey('${item}Text')), ); }).toList(), ); diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart index 3400170779..479fcbf040 100644 --- a/packages/flutter/test/material/text_field_test.dart +++ b/packages/flutter/test/material/text_field_test.dart @@ -158,8 +158,8 @@ void main() { 'Second line goes until\n' 'Third line of stuff'; const String kMoreThanFourLines = - kThreeLines + - "\nFourth line won't display and ends at"; + '$kThreeLines\n' + "Fourth line won't display and ends at"; // Gap between caret and edge of input, defined in editable.dart. const int kCaretGap = 1; @@ -992,7 +992,7 @@ void main() { // Enter a string with the same number of characters as testValueTwoLines, // but where the overflowing part is all spaces. Assert that it only renders // on one line. - const String testValueSpaces = testValueOneLine + ' '; + const String testValueSpaces = '$testValueOneLine '; expect(testValueSpaces.length, testValueTwoLines.length); await tester.enterText(find.byType(TextField), testValueSpaces); await skipPastScrollingAnimation(tester); @@ -1002,7 +1002,7 @@ void main() { expect(inputBox.size.height, oneLineInputSize.height); // Swapping the final space for a letter causes it to wrap to 2 lines. - const String testValueSpacesOverflow = testValueOneLine + ' a'; + const String testValueSpacesOverflow = '$testValueOneLine a'; expect(testValueSpacesOverflow.length, testValueTwoLines.length); await tester.enterText(find.byType(TextField), testValueSpacesOverflow); await skipPastScrollingAnimation(tester); @@ -3873,8 +3873,8 @@ void main() { )); const String surrogatePair = '😆'; - await tester.enterText(find.byType(TextField), surrogatePair + '0123456789101112'); - expect(textController.text, surrogatePair + '012345678'); + await tester.enterText(find.byType(TextField), '${surrogatePair}0123456789101112'); + expect(textController.text, '${surrogatePair}012345678'); }); testWidgets('maxLength limits input with grapheme clusters.', (WidgetTester tester) async { @@ -3888,8 +3888,8 @@ void main() { )); const String graphemeCluster = '👨‍👩‍👦'; - await tester.enterText(find.byType(TextField), graphemeCluster + '0123456789101112'); - expect(textController.text, graphemeCluster + '012345678'); + await tester.enterText(find.byType(TextField), '${graphemeCluster}0123456789101112'); + expect(textController.text, '${graphemeCluster}012345678'); }); testWidgets('maxLength limits input in the center of a maxed-out field.', (WidgetTester tester) async { @@ -3909,7 +3909,7 @@ void main() { expect(textController.text, testValue); // Entering more characters at the end does nothing. - await tester.enterText(find.byType(TextField), testValue + '9999999'); + await tester.enterText(find.byType(TextField), '${testValue}9999999'); expect(textController.text, testValue); // Entering text in the middle of the field also does nothing. @@ -3943,7 +3943,7 @@ void main() { // Entering more characters at the end does nothing. await tester.showKeyboard(find.byType(TextField)); tester.testTextInput.updateEditingValue(const TextEditingValue( - text: testValue + '9999999', + text: '${testValue}9999999', selection: TextSelection.collapsed(offset: 10 + 7), composing: TextRange.empty, )); @@ -4175,8 +4175,8 @@ void main() { )); const String surrogatePair = '😆'; - await tester.enterText(find.byType(TextField), surrogatePair + '0123456789101112'); - expect(textController.text, surrogatePair + '012345678'); + await tester.enterText(find.byType(TextField), '${surrogatePair}0123456789101112'); + expect(textController.text, '${surrogatePair}012345678'); }); testWidgets('maxLength limits input with grapheme clusters.', (WidgetTester tester) async { @@ -4190,8 +4190,8 @@ void main() { )); const String graphemeCluster = '👨‍👩‍👦'; - await tester.enterText(find.byType(TextField), graphemeCluster + '0123456789101112'); - expect(textController.text, graphemeCluster + '012345678'); + await tester.enterText(find.byType(TextField), '${graphemeCluster}0123456789101112'); + expect(textController.text, '${graphemeCluster}012345678'); }); testWidgets('setting maxLength shows counter', (WidgetTester tester) async { diff --git a/packages/flutter/test/services/platform_channel_test.dart b/packages/flutter/test/services/platform_channel_test.dart index 6adc07b65d..c70e6d8d32 100644 --- a/packages/flutter/test/services/platform_channel_test.dart +++ b/packages/flutter/test/services/platform_channel_test.dart @@ -14,14 +14,14 @@ void main() { test('can send string message and get reply', () async { TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger.setMockMessageHandler( 'ch', - (ByteData? message) async => string.encodeMessage(string.decodeMessage(message)! + ' world'), + (ByteData? message) async => string.encodeMessage('${string.decodeMessage(message)!} world'), ); final String? reply = await channel.send('hello'); expect(reply, equals('hello world')); }); test('can receive string message and send reply', () async { - channel.setMessageHandler((String? message) async => message! + ' world'); + channel.setMessageHandler((String? message) async => '${message!} world'); String? reply; await TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger.handlePlatformMessage( 'ch', @@ -279,8 +279,8 @@ void main() { final Map methodCall = jsonMessage.decodeMessage(message) as Map; if (methodCall['method'] == 'listen') { final String argument = methodCall['args'] as String; - emitEvent(jsonMethod.encodeSuccessEnvelope(argument + '1')); - emitEvent(jsonMethod.encodeSuccessEnvelope(argument + '2')); + emitEvent(jsonMethod.encodeSuccessEnvelope('${argument}1')); + emitEvent(jsonMethod.encodeSuccessEnvelope('${argument}2')); emitEvent(null); return jsonMethod.encodeSuccessEnvelope(null); } else if (methodCall['method'] == 'cancel') { diff --git a/packages/flutter/test/widgets/form_test.dart b/packages/flutter/test/widgets/form_test.dart index 846c62c85f..eb47fa9d18 100644 --- a/packages/flutter/test/widgets/form_test.dart +++ b/packages/flutter/test/widgets/form_test.dart @@ -86,7 +86,7 @@ void main() { testWidgets('Validator sets the error text only when validate is called', (WidgetTester tester) async { final GlobalKey formKey = GlobalKey(); - String? errorText(String? value) => (value ?? '') + '/error'; + String? errorText(String? value) => '${value ?? ''}/error'; Widget builder(AutovalidateMode autovalidateMode) { return MaterialApp( @@ -274,7 +274,7 @@ void main() { await tester.pump(); // Check for a new Text widget with our error text. - expect(find.text(testValue + '/error'), findsOneWidget); + expect(find.text('$testValue/error'), findsOneWidget); return; } diff --git a/packages/flutter/test/widgets/selectable_text_test.dart b/packages/flutter/test/widgets/selectable_text_test.dart index d05f943336..82e9f135b4 100644 --- a/packages/flutter/test/widgets/selectable_text_test.dart +++ b/packages/flutter/test/widgets/selectable_text_test.dart @@ -131,8 +131,8 @@ void main() { 'Second line goes until\n' 'Third line of stuff'; const String kMoreThanFourLines = - kThreeLines + - "\nFourth line won't display and ends at"; + '$kThreeLines\n' + "Fourth line won't display and ends at"; // Returns the first RenderEditable. RenderEditable findRenderEditable(WidgetTester tester) { diff --git a/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart b/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart index 6b155ae513..0336aaf683 100644 --- a/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart +++ b/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart @@ -58,7 +58,7 @@ void _tests() { .split('\n') .map((String line) => line.trim()) .join('\n') - .trim() + ','; + .trim(); File? findThisTestFile(Directory directory) { for (final FileSystemEntity entity in directory.listSync()) { @@ -86,7 +86,7 @@ void _tests() { .join('\n') .trim(); semantics.dispose(); - expect(code, expectedCode); + expect('$code,', expectedCode); }); testWidgets('generated code is correct', (WidgetTester tester) async { diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart index 2c53152124..c1ac59954c 100644 --- a/packages/flutter/test/widgets/widget_inspector_test.dart +++ b/packages/flutter/test/widgets/widget_inspector_test.dart @@ -1009,8 +1009,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { .pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - pubRootTest = '/' + - segments.take(segments.length - 2).join('/'); + pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; service.setPubRootDirectories([pubRootTest]); } final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); @@ -1072,8 +1071,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { .pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - pubRootTest = '/' + - segments.take(segments.length - 2).join('/'); + pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; service.setPubRootDirectories([pubRootTest]); } final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); @@ -1231,7 +1229,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri.parse(fileA).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - final String pubRootTest = '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; service.setPubRootDirectories([pubRootTest]); service.setSelection(elementA, 'my-group'); @@ -1270,7 +1268,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { expect(pathSegmentsFramework.join('/'), endsWith('/flutter/lib/src/widgets/text.dart')); // Strip off /src/widgets/text.dart. - final String pubRootFramework = '/' + pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/'); + final String pubRootFramework = '/${pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/')}'; service.setPubRootDirectories([pubRootFramework]); expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); service.setSelection(elementA, 'my-group'); @@ -1621,7 +1619,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri.parse(testFile).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - final String pubRootTest = '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; await service.testExtension('setPubRootDirectories', {'arg0': pubRootTest}); rootJson = (await service.testExtension('getRootWidgetSummaryTree', {'objectGroup': group}))! as Map; @@ -1704,7 +1702,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri.parse(testFile).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - final String pubRootTest = '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; await service.testExtension('setPubRootDirectories', {'arg0': pubRootTest}); summarySelection = (await service.testExtension('getSelectedSummaryWidget', {'objectGroup': group}))! as Map; @@ -1805,7 +1803,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri.parse(fileA).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - final String pubRootTest = '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; await service.testExtension('setPubRootDirectories', {'arg0': pubRootTest}); service.setSelection(elementA, 'my-group'); @@ -1845,7 +1843,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { expect(pathSegmentsFramework.join('/'), endsWith('/flutter/lib/src/widgets/text.dart')); // Strip off /src/widgets/text.dart. - final String pubRootFramework = '/' + pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/'); + final String pubRootFramework = '/${pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/')}'; await service.testExtension('setPubRootDirectories', {'arg0': pubRootFramework}); expect(await service.testExtension('getSelectedWidget', {'objectGroup': 'my-group'}), contains('createdByLocalProject')); service.setSelection(elementA, 'my-group'); @@ -1886,7 +1884,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri.parse(fileA).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - final String pubRootTest = '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; await service.testExtension('setPubRootDirectories', {'arg0': pubRootTest, 'isolateId': '34'}); service.setSelection(elementA, 'my-group'); @@ -1929,8 +1927,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri.parse(file).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - final String pubRootTest = - '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; await service.testExtension('setPubRootDirectories', {'arg0': pubRootTest}); final List> rebuildEvents = @@ -2125,8 +2122,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri.parse(file).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. - final String pubRootTest = - '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; await service.testExtension('setPubRootDirectories', {'arg0': pubRootTest}); final List> repaintEvents = @@ -2861,7 +2857,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { expect(file, endsWith('widget_inspector_test.dart')); final List segments = Uri.parse(file).pathSegments; // Strip a couple subdirectories away to generate a plausible pub rootdirectory. - final String pubRootTest = '/' + segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; service.setPubRootDirectories([pubRootTest]); final String summary = service.getRootWidgetSummaryTree('foo1'); @@ -3034,8 +3030,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final List segments = Uri .parse(file) .pathSegments; - final String pubRootTest = '/' + - segments.take(segments.length - 2).join('/'); + final String pubRootTest = '/${segments.take(segments.length - 2).join('/')}'; // Strip a couple subdirectories away to generate a plausible pub root // directory. diff --git a/packages/flutter_goldens/lib/flutter_goldens.dart b/packages/flutter_goldens/lib/flutter_goldens.dart index 407edecb53..97375513a3 100644 --- a/packages/flutter_goldens/lib/flutter_goldens.dart +++ b/packages/flutter_goldens/lib/flutter_goldens.dart @@ -168,7 +168,7 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator { /// test. Uri _addPrefix(Uri golden) { final String prefix = basedir.pathSegments[basedir.pathSegments.length - 2]; - return Uri.parse(prefix + '.' + golden.toString()); + return Uri.parse('$prefix.$golden'); } } diff --git a/packages/flutter_goldens_client/lib/skia_client.dart b/packages/flutter_goldens_client/lib/skia_client.dart index 6af65e9827..235b64a6bf 100644 --- a/packages/flutter_goldens_client/lib/skia_client.dart +++ b/packages/flutter_goldens_client/lib/skia_client.dart @@ -368,7 +368,7 @@ class SkiaGoldClient { }; if (platform.environment[_kTestBrowserKey] != null) { keys['Browser'] = platform.environment[_kTestBrowserKey]; - keys['Platform'] = keys['Platform'] + '-browser'; + keys['Platform'] = '${keys['Platform']}-browser'; } return json.encode(keys); } diff --git a/packages/flutter_localizations/lib/src/utils/date_localizations.dart b/packages/flutter_localizations/lib/src/utils/date_localizations.dart index ee2de56183..aa5ce52846 100644 --- a/packages/flutter_localizations/lib/src/utils/date_localizations.dart +++ b/packages/flutter_localizations/lib/src/utils/date_localizations.dart @@ -35,7 +35,7 @@ void loadDateIntlDataIfNotLoaded() { } else if (codes.length == 3) { countryCode = codes[1].length < codes[2].length ? codes[1] : codes[2]; } - locale = codes[0] + (countryCode != null ? '_' + countryCode : ''); + locale = codes[0] + (countryCode != null ? '_$countryCode' : ''); if (initializedLocales.contains(locale)) return; initializedLocales.add(locale); diff --git a/packages/flutter_test/lib/src/_goldens_io.dart b/packages/flutter_test/lib/src/_goldens_io.dart index 0908a43b87..68ad87e9fe 100644 --- a/packages/flutter_test/lib/src/_goldens_io.dart +++ b/packages/flutter_test/lib/src/_goldens_io.dart @@ -146,7 +146,7 @@ mixin LocalComparisonOutput { final Map diffs = result.diffs!.cast(); for (final MapEntry entry in diffs.entries) { final File output = getFailureFile( - key.isEmpty ? entry.key : entry.key + '_' + key, + key.isEmpty ? entry.key : '${entry.key}_$key', golden, basedir, ); @@ -161,10 +161,7 @@ mixin LocalComparisonOutput { /// Returns the appropriate file for a given diff from a [ComparisonResult]. File getFailureFile(String failure, Uri golden, Uri basedir) { final String fileName = golden.pathSegments.last; - final String testName = fileName.split(path.extension(fileName))[0] - + '_' - + failure - + '.png'; + final String testName = '${fileName.split(path.extension(fileName))[0]}_$failure.png'; return File(path.join( path.fromUri(basedir), path.fromUri(Uri.parse('failures/$testName')), diff --git a/packages/flutter_test/lib/src/goldens.dart b/packages/flutter_test/lib/src/goldens.dart index 0143a71d7c..c2f666341f 100644 --- a/packages/flutter_test/lib/src/goldens.dart +++ b/packages/flutter_test/lib/src/goldens.dart @@ -85,11 +85,7 @@ abstract class GoldenFileComparator { return key; final String keyString = key.toString(); final String extension = path.extension(keyString); - return Uri.parse( - keyString - .split(extension) - .join() + '.' + version.toString() + extension - ); + return Uri.parse('${keyString.split(extension).join()}.$version$extension'); } /// Returns a [ComparisonResult] to describe the pixel differential of the @@ -196,11 +192,7 @@ abstract class WebGoldenComparator { return key; final String keyString = key.toString(); final String extension = path.extension(keyString); - return Uri.parse( - keyString - .split(extension) - .join() + '.' + version.toString() + extension - ); + return Uri.parse('${keyString.split(extension).join()}.$version$extension'); } } diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index 0234dde9e2..43b9eee692 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -1926,7 +1926,7 @@ class _DoesNotMatchAccessibilityGuideline extends AsyncMatcher { @override Description describe(Description description) { - return description.add('Does not ' + guideline.description); + return description.add('Does not ${guideline.description}'); } @override diff --git a/packages/flutter_test/test/controller_test.dart b/packages/flutter_test/test/controller_test.dart index 96b4569e4f..25f33e6776 100644 --- a/packages/flutter_test/test/controller_test.dart +++ b/packages/flutter_test/test/controller_test.dart @@ -383,8 +383,8 @@ void main() { testResult.expectedOffsets[valueIndex], offsetMoreOrLessEquals(dragOffsets[valueIndex]), reason: - 'There is a difference in the expected and actual value of the ' + - (valueIndex == 2 ? 'first' : valueIndex == 3 ? 'second' : 'third') + + 'There is a difference in the expected and actual value of the ' + '${valueIndex == 2 ? 'first' : valueIndex == 3 ? 'second' : 'third'}' ' split offset for the drag with:\n' 'Touch slop: ${testResult.slop}\n' 'Delta: ${testResult.dragDistance}\n' diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart index 2704e572a2..43b7a04e6e 100644 --- a/packages/flutter_tools/lib/src/android/gradle.dart +++ b/packages/flutter_tools/lib/src/android/gradle.dart @@ -991,7 +991,7 @@ File findBundleFile(FlutterProject project, BuildInfo buildInfo, Logger logger, // the directory name is `foo_barRelease`. fileCandidates.add( getBundleDirectory(project) - .childDirectory('${buildInfo.lowerCasedFlavor}${camelCase('_' + buildInfo.modeName)}') + .childDirectory('${buildInfo.lowerCasedFlavor}${camelCase('_${buildInfo.modeName}')}') .childFile('app.aab')); // The Android Gradle plugin 3.5.0 adds the flavor name to file name. @@ -999,7 +999,7 @@ File findBundleFile(FlutterProject project, BuildInfo buildInfo, Logger logger, // the file name name is `app-foo_bar-release.aab`. fileCandidates.add( getBundleDirectory(project) - .childDirectory('${buildInfo.lowerCasedFlavor}${camelCase('_' + buildInfo.modeName)}') + .childDirectory('${buildInfo.lowerCasedFlavor}${camelCase('_${buildInfo.modeName}')}') .childFile('app-${buildInfo.lowerCasedFlavor}-${buildInfo.modeName}.aab')); } for (final File bundleFile in fileCandidates) { diff --git a/packages/flutter_tools/lib/src/android/gradle_errors.dart b/packages/flutter_tools/lib/src/android/gradle_errors.dart index ab4a5c6fb8..2075c391be 100644 --- a/packages/flutter_tools/lib/src/android/gradle_errors.dart +++ b/packages/flutter_tools/lib/src/android/gradle_errors.dart @@ -379,16 +379,18 @@ final GradleHandledError minSdkVersion = GradleHandledError( final Match minSdkVersionMatch = _minSdkVersionPattern.firstMatch(line); assert(minSdkVersionMatch.groupCount == 3); + final String bold = globals.logger.terminal.bolden( + 'Fix this issue by adding the following to the file ${gradleFile.path}:\n' + 'android {\n' + ' defaultConfig {\n' + ' minSdkVersion ${minSdkVersionMatch.group(2)}\n' + ' }\n' + '}\n' + ); globals.printStatus( - '\nThe plugin ${minSdkVersionMatch.group(3)} requires a higher Android SDK version.\n'+ - globals.logger.terminal.bolden( - 'Fix this issue by adding the following to the file ${gradleFile.path}:\n' - 'android {\n' - ' defaultConfig {\n' - ' minSdkVersion ${minSdkVersionMatch.group(2)}\n' - ' }\n' - '}\n\n' - )+ + '\n' + 'The plugin ${minSdkVersionMatch.group(3)} requires a higher Android SDK version.\n' + '$bold\n' "Note that your app won't be available to users running Android SDKs below ${minSdkVersionMatch.group(2)}.\n" 'Alternatively, try to find a version of this plugin that supports these lower versions of the Android SDK.' ); @@ -414,17 +416,18 @@ final GradleHandledError transformInputIssue = GradleHandledError( .childDirectory('android') .childDirectory('app') .childFile('build.gradle'); - + final String bold = globals.logger.terminal.bolden( + 'Fix this issue by adding the following to the file ${gradleFile.path}:\n' + 'android {\n' + ' lintOptions {\n' + ' checkReleaseBuilds false\n' + ' }\n' + '}' + ); globals.printStatus( - '\nThis issue appears to be https://github.com/flutter/flutter/issues/58247.\n'+ - globals.logger.terminal.bolden( - 'Fix this issue by adding the following to the file ${gradleFile.path}:\n' - 'android {\n' - ' lintOptions {\n' - ' checkReleaseBuilds false\n' - ' }\n' - '}' - ) + '\n' + 'This issue appears to be https://github.com/flutter/flutter/issues/58247.\n' + '$bold' ); return GradleBuildStatus.exit; }, @@ -446,13 +449,14 @@ final GradleHandledError lockFileDepMissing = GradleHandledError( final File gradleFile = project.directory .childDirectory('android') .childFile('build.gradle'); - + final String bold = globals.logger.terminal.bolden( + 'To regenerate the lockfiles run: `./gradlew :generateLockfiles` in ${gradleFile.path}\n' + 'To remove dependency locking, remove the `dependencyLocking` from ${gradleFile.path}\n' + ); globals.printStatus( - '\nYou need to update the lockfile, or disable Gradle dependency locking.\n'+ - globals.logger.terminal.bolden( - 'To regenerate the lockfiles run: `./gradlew :generateLockfiles` in ${gradleFile.path}\n' - 'To remove dependency locking, remove the `dependencyLocking` from ${gradleFile.path}\n' - ) + '\n' + 'You need to update the lockfile, or disable Gradle dependency locking.\n' + '$bold' ); return GradleBuildStatus.exit; }, diff --git a/packages/flutter_tools/lib/src/base/analyze_size.dart b/packages/flutter_tools/lib/src/base/analyze_size.dart index 335f5f399f..c1a8a83425 100644 --- a/packages/flutter_tools/lib/src/base/analyze_size.dart +++ b/packages/flutter_tools/lib/src/base/analyze_size.dart @@ -331,7 +331,7 @@ class SizeAnalyzer { } for (; i < localSegments.length; i += 1) { _logger.printStatus( - localSegments[i] + '/', + '${localSegments[i]}/', indent: (level + i) * 2, emphasis: true, ); diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart index b67eb79388..938cf5dfdc 100644 --- a/packages/flutter_tools/lib/src/base/build.dart +++ b/packages/flutter_tools/lib/src/base/build.dart @@ -67,7 +67,7 @@ class GenSnapshot { // iOS has a separate gen_snapshot for armv7 and arm64 in the same, // directory. So we need to select the right one. if (snapshotType.platform == TargetPlatform.ios) { - snapshotterPath += '_' + getNameForDarwinArch(darwinArch!); + snapshotterPath += '_${getNameForDarwinArch(darwinArch!)}'; } return _processUtils.stream( diff --git a/packages/flutter_tools/lib/src/base/fingerprint.dart b/packages/flutter_tools/lib/src/base/fingerprint.dart index 08119e9f57..ad8a8da046 100644 --- a/packages/flutter_tools/lib/src/base/fingerprint.dart +++ b/packages/flutter_tools/lib/src/base/fingerprint.dart @@ -86,7 +86,7 @@ class Fingerprint { final Iterable files = inputPaths.map(fileSystem.file); final Iterable missingInputs = files.where((File file) => !file.existsSync()); if (missingInputs.isNotEmpty) { - throw Exception('Missing input files:\n' + missingInputs.join('\n')); + throw Exception('Missing input files:\n${missingInputs.join('\n')}'); } return Fingerprint._( checksums: { diff --git a/packages/flutter_tools/lib/src/base/logger.dart b/packages/flutter_tools/lib/src/base/logger.dart index 85a519be1c..c0151c644f 100644 --- a/packages/flutter_tools/lib/src/base/logger.dart +++ b/packages/flutter_tools/lib/src/base/logger.dart @@ -422,7 +422,7 @@ class StdoutLogger extends Logger { @override void clear() { _status?.pause(); - writeToStdOut(terminal.clearScreen() + '\n'); + writeToStdOut('${terminal.clearScreen()}\n'); _status?.resume(); } } diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart index b69ded1ae9..81b16fa4cc 100644 --- a/packages/flutter_tools/lib/src/base/utils.dart +++ b/packages/flutter_tools/lib/src/base/utils.dart @@ -42,7 +42,7 @@ String toTitleCase(String str) { } /// Return the plural of the given word (`cat(s)`). -String pluralize(String word, int count) => count == 1 ? word : word + 's'; +String pluralize(String word, int count) => count == 1 ? word : '${word}s'; /// Return the name of an enum item. String getEnumName(dynamic enumItem) { @@ -52,7 +52,8 @@ String getEnumName(dynamic enumItem) { } String toPrettyJson(Object jsonable) { - return const JsonEncoder.withIndent(' ').convert(jsonable) + '\n'; + final String value = const JsonEncoder.withIndent(' ').convert(jsonable); + return '$value\n'; } final NumberFormat kSecondsFormat = NumberFormat('0.0'); diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart index df2fcf4810..ebd7e9ad3d 100644 --- a/packages/flutter_tools/lib/src/build_info.dart +++ b/packages/flutter_tools/lib/src/build_info.dart @@ -798,7 +798,7 @@ String getLinuxBuildDirectory([TargetPlatform? targetPlatform]) { final String arch = (targetPlatform == null) ? _getCurrentHostPlatformArchName() : getNameForTargetPlatformArch(targetPlatform); - final String subDirs = 'linux/' + arch; + final String subDirs = 'linux/$arch'; return globals.fs.path.join(getBuildDirectory(), subDirs); } diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart index 0262df6742..0a0e9f4dbc 100644 --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart @@ -766,7 +766,7 @@ abstract class EngineCachedArtifact extends CachedArtifact { final Directory pkgDir = cache.getCacheDir('pkg'); for (final String pkgName in getPackageDirs()) { - await artifactUpdater.downloadZipArchive('Downloading package $pkgName...', Uri.parse(url + pkgName + '.zip'), pkgDir); + await artifactUpdater.downloadZipArchive('Downloading package $pkgName...', Uri.parse('$url$pkgName.zip'), pkgDir); } for (final List toolsDir in getBinaryDirs()) { @@ -802,7 +802,7 @@ abstract class EngineCachedArtifact extends CachedArtifact { bool exists = false; for (final String pkgName in getPackageDirs()) { - exists = await cache.doesRemoteExist('Checking package $pkgName is available...', Uri.parse(url + pkgName + '.zip')); + exists = await cache.doesRemoteExist('Checking package $pkgName is available...', Uri.parse('$url$pkgName.zip')); if (!exists) { return false; } diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index e30c10f9cd..14a7025ee1 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart @@ -421,7 +421,7 @@ Your $application code is in $relativeAppMain. final String projectName = templateContext['projectName'] as String; final String organization = templateContext['organization'] as String; final String androidPluginIdentifier = templateContext['androidIdentifier'] as String; - final String exampleProjectName = projectName + '_example'; + final String exampleProjectName = '${projectName}_example'; templateContext['projectName'] = exampleProjectName; templateContext['androidIdentifier'] = CreateBase.createAndroidIdentifier(organization, exampleProjectName); templateContext['iosIdentifier'] = CreateBase.createUTIIdentifier(organization, exampleProjectName); diff --git a/packages/flutter_tools/lib/src/commands/create_base.dart b/packages/flutter_tools/lib/src/commands/create_base.dart index 70b8daab5d..0b8a59cfca 100644 --- a/packages/flutter_tools/lib/src/commands/create_base.dart +++ b/packages/flutter_tools/lib/src/commands/create_base.dart @@ -332,7 +332,7 @@ abstract class CreateBase extends FlutterCommand { final String pluginDartClass = _createPluginClassName(projectName); final String pluginClass = pluginDartClass.endsWith('Plugin') ? pluginDartClass - : pluginDartClass + 'Plugin'; + : '${pluginDartClass}Plugin'; final String pluginClassSnakeCase = snakeCase(pluginClass); final String pluginClassCapitalSnakeCase = pluginClassSnakeCase.toUpperCase(); @@ -465,7 +465,7 @@ abstract class CreateBase extends FlutterCommand { final RegExp segmentPatternRegex = RegExp(r'^[a-zA-Z][\w]*$'); final List prefixedSegments = segments.map((String segment) { if (!segmentPatternRegex.hasMatch(segment)) { - return 'u' + segment; + return 'u$segment'; } return segment; }).toList(); diff --git a/packages/flutter_tools/lib/src/commands/emulators.dart b/packages/flutter_tools/lib/src/commands/emulators.dart index 1f9ea1dcbf..eb8b35c40f 100644 --- a/packages/flutter_tools/lib/src/commands/emulators.dart +++ b/packages/flutter_tools/lib/src/commands/emulators.dart @@ -39,9 +39,7 @@ class EmulatorsCommand extends FlutterCommand { if (globals.doctor.workflows.every((Workflow w) => !w.canListEmulators)) { throwToolExit( 'Unable to find any emulator sources. Please ensure you have some\n' - 'Android AVD images ' + - (globals.platform.isMacOS ? 'or an iOS Simulator ' : '') + - 'available.', + 'Android AVD images ${globals.platform.isMacOS ? 'or an iOS Simulator ' : ''}available.', exitCode: 1); } diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart index d9ade7edce..09eea05e4d 100644 --- a/packages/flutter_tools/lib/src/commands/update_packages.dart +++ b/packages/flutter_tools/lib/src/commands/update_packages.dart @@ -1116,7 +1116,7 @@ class PubspecDependency extends PubspecLine { final String trailingComment = line.substring(hashIndex, line.length); assert(line.endsWith(trailingComment)); isTransitive = trailingComment == kTransitiveMagicString; - suffix = ' ' + trailingComment; + suffix = ' $trailingComment'; stripped = line.substring(colonIndex + 1, hashIndex).trimRight(); } else { stripped = line.substring(colonIndex + 1, line.length).trimRight(); diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index 983d3ce37c..e8a69fbafc 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -938,7 +938,7 @@ String toMultiRootPath(Uri fileUri, String? scheme, List fileSystemRoots final String filePath = fileUri.toFilePath(windows: windows); for (final String fileSystemRoot in fileSystemRoots) { if (filePath.startsWith(fileSystemRoot)) { - return scheme + '://' + filePath.substring(fileSystemRoot.length); + return '$scheme://${filePath.substring(fileSystemRoot.length)}'; } } return fileUri.toString(); diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index 8784d9ea20..047faebe52 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -640,7 +640,7 @@ class DevFS { } /// Converts a platform-specific file path to a platform-independent URL path. - String _asUriPath(String filePath) => _fileSystem.path.toUri(filePath).path + '/'; + String _asUriPath(String filePath) => '${_fileSystem.path.toUri(filePath).path}/'; } /// An implementation of a devFS writer which copies physical files for devices diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index 44247c0a27..6affb37f20 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -650,7 +650,7 @@ abstract class Device { // Join columns into lines of text for (final List row in table) { - yield indices.map((int i) => row[i].padRight(widths[i])).join(' • ') + ' • ${row.last}'; + yield indices.map((int i) => row[i].padRight(widths[i])).followedBy([row.last]).join(' • '); } } diff --git a/packages/flutter_tools/lib/src/doctor_validator.dart b/packages/flutter_tools/lib/src/doctor_validator.dart index 20f8a43a73..d5488c00c0 100644 --- a/packages/flutter_tools/lib/src/doctor_validator.dart +++ b/packages/flutter_tools/lib/src/doctor_validator.dart @@ -127,7 +127,7 @@ class GroupedValidator extends DoctorValidator { } break; default: - throw 'Unrecognized validation type: ' + result.type.toString(); + throw 'Unrecognized validation type: ${result.type}'; } mergedMessages.addAll(result.messages); } diff --git a/packages/flutter_tools/lib/src/emulator.dart b/packages/flutter_tools/lib/src/emulator.dart index 327a5f1ce3..557c86b415 100644 --- a/packages/flutter_tools/lib/src/emulator.dart +++ b/packages/flutter_tools/lib/src/emulator.dart @@ -301,9 +301,9 @@ abstract class Emulator { return table .map((List row) { return indices - .map((int i) => row[i].padRight(widths[i])) - .join(' • ') + - ' • ${row.last}'; + .map((int i) => row[i].padRight(widths[i])) + .followedBy([row.last]) + .join(' • '); }) .map((String line) => line.replaceAll(whiteSpaceAndDots, '')) .toList(); diff --git a/packages/flutter_tools/lib/src/flutter_plugins.dart b/packages/flutter_tools/lib/src/flutter_plugins.dart index 9e4f42f17f..e805b3caee 100644 --- a/packages/flutter_tools/lib/src/flutter_plugins.dart +++ b/packages/flutter_tools/lib/src/flutter_plugins.dart @@ -951,8 +951,7 @@ void handleSymlinkException(FileSystemException e, { ' start ms-settings:developers\n' 'to open settings.' : 'You must build from a terminal run as administrator.'; - throwToolExit('Building with plugins requires symlink support.\n\n' + - instructions); + throwToolExit('Building with plugins requires symlink support.\n\n$instructions'); } } diff --git a/packages/flutter_tools/lib/src/intellij/intellij_validator.dart b/packages/flutter_tools/lib/src/intellij/intellij_validator.dart index de751e1f07..d2fc4cf84c 100644 --- a/packages/flutter_tools/lib/src/intellij/intellij_validator.dart +++ b/packages/flutter_tools/lib/src/intellij/intellij_validator.dart @@ -229,9 +229,9 @@ class IntelliJValidatorOnWindows extends IntelliJValidator { } if (installPath != null && fileSystem.isDirectorySync(installPath)) { String pluginsPath; - if (fileSystem.isDirectorySync(installPath + '.plugins')) { + if (fileSystem.isDirectorySync('$installPath.plugins')) { // IntelliJ 2020.3 - pluginsPath = installPath + '.plugins'; + pluginsPath = '$installPath.plugins'; addValidator(title, version, installPath, pluginsPath); } else if (platform.environment.containsKey('APPDATA')) { final String pluginsPathInAppData = fileSystem.path.join( @@ -340,7 +340,7 @@ class IntelliJValidatorOnLinux extends IntelliJValidator { name); if (installPath.contains(fileSystem.path.join('JetBrains','Toolbox','apps'))) { // via JetBrains ToolBox app - final String pluginsPathInInstallDir = installPath + '.plugins'; + final String pluginsPathInInstallDir = '$installPath.plugins'; if (fileSystem.isDirectorySync(pluginsPathInUserHomeDir)) { // after 2020.2.x final String pluginsPath = pluginsPathInUserHomeDir; @@ -517,7 +517,7 @@ class IntelliJValidatorOnMac extends IntelliJValidator { .getValueFromFile(plistFile, 'JetBrainsToolboxApp'); if (altLocation != null) { - _pluginsPath = altLocation + '.plugins'; + _pluginsPath = '$altLocation.plugins'; return _pluginsPath!; } diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart index 481fbd7200..78b2cc0037 100644 --- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart @@ -373,7 +373,7 @@ class XcodeProjectInfo { if (buildInfo.flavor == null) { return baseConfiguration; } - return baseConfiguration + '-$scheme'; + return '$baseConfiguration-$scheme'; } /// Checks whether the [buildConfigurations] contains the specified string, without diff --git a/packages/flutter_tools/lib/src/isolated/devfs_web.dart b/packages/flutter_tools/lib/src/isolated/devfs_web.dart index cfffb87005..6cac27f9bf 100644 --- a/packages/flutter_tools/lib/src/isolated/devfs_web.dart +++ b/packages/flutter_tools/lib/src/isolated/devfs_web.dart @@ -841,7 +841,7 @@ class WebDevFS implements DevFS { final CompilerOutput compilerOutput = await generator.recompile( Uri( scheme: 'org-dartlang-app', - path: '/' + mainUri.pathSegments.last, + path: '/${mainUri.pathSegments.last}', ), invalidatedFiles, outputPath: dillOutputPath, diff --git a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart index 46777c3b5c..3c2ebaf492 100644 --- a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart +++ b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart @@ -440,7 +440,7 @@ class ResidentWebRunner extends ResidentRunner { flutterDevices.first.generator.addFileSystemRoot(_fileSystem.directory('test').absolute.path); importedEntrypoint = Uri( scheme: 'org-dartlang-app', - path: '/' + mainUri.pathSegments.last, + path: '/${mainUri.pathSegments.last}', ); } final LanguageVersion languageVersion = determineLanguageVersion( diff --git a/packages/flutter_tools/lib/src/license_collector.dart b/packages/flutter_tools/lib/src/license_collector.dart index b2926aba4f..368aab7701 100644 --- a/packages/flutter_tools/lib/src/license_collector.dart +++ b/packages/flutter_tools/lib/src/license_collector.dart @@ -31,7 +31,7 @@ class LicenseCollector { final FileSystem _fileSystem; /// The expected separator for multiple licenses. - static final String licenseSeparator = '\n' + ('-' * 80) + '\n'; + static final String licenseSeparator = '\n${'-' * 80}\n'; /// Obtain licenses from the `packageMap` into a single result. /// @@ -86,7 +86,7 @@ class LicenseCollector { .map((String license) { final List packageNames = packageLicenses[license]!.toList() ..sort(); - return packageNames.join('\n') + '\n\n' + license; + return '${packageNames.join('\n')}\n\n$license'; }).toList(); combinedLicensesList.sort(); diff --git a/packages/flutter_tools/lib/src/linux/build_linux.dart b/packages/flutter_tools/lib/src/linux/build_linux.dart index ce45b0fed2..7ba9264a2a 100644 --- a/packages/flutter_tools/lib/src/linux/build_linux.dart +++ b/packages/flutter_tools/lib/src/linux/build_linux.dart @@ -131,7 +131,7 @@ Future _runCmake(String buildModeName, Directory sourceDir, Directory buil '-G', 'Ninja', '-DCMAKE_BUILD_TYPE=$buildFlag', - '-DFLUTTER_TARGET_PLATFORM=' + getNameForTargetPlatform(targetPlatform), + '-DFLUTTER_TARGET_PLATFORM=${getNameForTargetPlatform(targetPlatform)}', // Support cross-building for arm64 targets on x64 hosts. // (Cross-building for x64 on arm64 hosts isn't supported now.) if (needCrossBuild) diff --git a/packages/flutter_tools/lib/src/localizations/localizations_utils.dart b/packages/flutter_tools/lib/src/localizations/localizations_utils.dart index dd221a0237..04fcca4267 100644 --- a/packages/flutter_tools/lib/src/localizations/localizations_utils.dart +++ b/packages/flutter_tools/lib/src/localizations/localizations_utils.dart @@ -93,10 +93,10 @@ class LocaleInfo implements Comparable { // Update the base string to reflect assumed scriptCodes. originalString = languageCode; if (scriptCode != null) { - originalString += '_' + scriptCode; + originalString += '_$scriptCode'; } if (countryCode != null) { - originalString += '_' + countryCode; + originalString += '_$countryCode'; } } diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index fc07526861..38ba052d20 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -942,7 +942,7 @@ abstract class FlutterCommand extends Command { if (experiments.isNotEmpty) { for (final String expFlag in experiments) { - final String flag = '--enable-experiment=' + expFlag; + final String flag = '--enable-experiment=$expFlag'; extraFrontEndOptions.add(flag); extraGenSnapshotOptions.add(flag); } diff --git a/packages/flutter_tools/lib/src/runner/local_engine.dart b/packages/flutter_tools/lib/src/runner/local_engine.dart index 3567da4b96..e6537a6689 100644 --- a/packages/flutter_tools/lib/src/runner/local_engine.dart +++ b/packages/flutter_tools/lib/src/runner/local_engine.dart @@ -163,7 +163,7 @@ class LocalEngineLocator { for (final String suffix in suffixes) { tmpBasename = tmpBasename.replaceFirst(RegExp('$suffix\$'), ''); } - return 'host_' + tmpBasename; + return 'host_$tmpBasename'; } EngineBuildPaths _findEngineBuildPath(String localEngine, String enginePath) { diff --git a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart index 03a07625a2..c168d7c177 100644 --- a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart @@ -221,26 +221,26 @@ class FlutterWebPlatform extends PlatformPlugin { Future _handleTestRequest(shelf.Request request) async { if (request.url.path.endsWith('.dart.browser_test.dart.js')) { final String leadingPath = request.url.path.split('.browser_test.dart.js')[0]; - final String generatedFile = _fileSystem.path.split(leadingPath).join('_') + '.bootstrap.js'; - return shelf.Response.ok(generateTestBootstrapFileContents('/' + generatedFile, 'require.js', 'dart_stack_trace_mapper.js'), headers: { + final String generatedFile = '${_fileSystem.path.split(leadingPath).join('_')}.bootstrap.js'; + return shelf.Response.ok(generateTestBootstrapFileContents('/$generatedFile', 'require.js', 'dart_stack_trace_mapper.js'), headers: { HttpHeaders.contentTypeHeader: 'text/javascript', }); } if (request.url.path.endsWith('.dart.bootstrap.js')) { final String leadingPath = request.url.path.split('.dart.bootstrap.js')[0]; - final String generatedFile = _fileSystem.path.split(leadingPath).join('_') + '.dart.test.dart.js'; + final String generatedFile = '${_fileSystem.path.split(leadingPath).join('_')}.dart.test.dart.js'; return shelf.Response.ok(generateMainModule( nullAssertions: nullAssertions, nativeNullAssertions: true, - bootstrapModule: _fileSystem.path.basename(leadingPath) + '.dart.bootstrap', - entrypoint: '/' + generatedFile + bootstrapModule: '${_fileSystem.path.basename(leadingPath)}.dart.bootstrap', + entrypoint: '/$generatedFile' ), headers: { HttpHeaders.contentTypeHeader: 'text/javascript', }); } if (request.url.path.endsWith('.dart.js')) { final String path = request.url.path.split('.dart.js')[0]; - return shelf.Response.ok(webMemoryFS.files[path + '.dart.lib.js'], headers: { + return shelf.Response.ok(webMemoryFS.files['$path.dart.lib.js'], headers: { HttpHeaders.contentTypeHeader: 'text/javascript', }); } @@ -369,7 +369,7 @@ class FlutterWebPlatform extends PlatformPlugin { shelf.Response _wrapperHandler(shelf.Request request) { final String path = _fileSystem.path.fromUri(request.url); if (path.endsWith('.html')) { - final String test = _fileSystem.path.withoutExtension(path) + '.dart'; + final String test = '${_fileSystem.path.withoutExtension(path)}.dart'; final String scriptBase = htmlEscape.convert(_fileSystem.path.basename(test)); final String link = ''; return shelf.Response.ok(''' @@ -410,8 +410,8 @@ class FlutterWebPlatform extends PlatformPlugin { throw StateError('Load called on a closed FlutterWebPlatform'); } - final Uri suiteUrl = url.resolveUri(_fileSystem.path.toUri(_fileSystem.path.withoutExtension( - _fileSystem.path.relative(path, from: _fileSystem.path.join(_root, 'test'))) + '.html')); + final String pathFromTest = _fileSystem.path.relative(path, from: _fileSystem.path.join(_root, 'test')); + final Uri suiteUrl = url.resolveUri(_fileSystem.path.toUri('${_fileSystem.path.withoutExtension(pathFromTest)}.html')); final String relativePath = _fileSystem.path.relative(_fileSystem.path.normalize(path), from: _fileSystem.currentDirectory.path); final RunnerSuite suite = await _browserManager.load(relativePath, suiteUrl, suiteConfig, message, onDone: () async { await _browserManager.close(); diff --git a/packages/flutter_tools/lib/src/vscode/vscode.dart b/packages/flutter_tools/lib/src/vscode/vscode.dart index f4a2753c05..1a48053adc 100644 --- a/packages/flutter_tools/lib/src/vscode/vscode.dart +++ b/packages/flutter_tools/lib/src/vscode/vscode.dart @@ -82,7 +82,7 @@ class VsCode { Version? _extensionVersion; final List _validationMessages = []; - String get productName => 'VS Code' + (edition != null ? ', $edition' : ''); + String get productName => 'VS Code${edition != null ? ', $edition' : ''}'; Iterable get validationMessages => _validationMessages; diff --git a/packages/flutter_tools/lib/src/web/web_device.dart b/packages/flutter_tools/lib/src/web/web_device.dart index 9b118aba3e..7c214bbf30 100644 --- a/packages/flutter_tools/lib/src/web/web_device.dart +++ b/packages/flutter_tools/lib/src/web/web_device.dart @@ -217,7 +217,7 @@ class GoogleChromeDevice extends ChromiumDevice { if (result.exitCode == 0) { final List parts = (result.stdout as String).split(RegExp(r'\s+')); if (parts.length > 2) { - version = 'Google Chrome ' + parts[parts.length - 2]; + version = 'Google Chrome ${parts[parts.length - 2]}'; } } } @@ -278,7 +278,7 @@ class MicrosoftEdgeDevice extends ChromiumDevice { if (result.exitCode == 0) { final List parts = (result.stdout as String).split(RegExp(r'\s+')); if (parts.length > 2) { - return 'Microsoft Edge ' + parts[parts.length - 2]; + return 'Microsoft Edge ${parts[parts.length - 2]}'; } } } diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index 19f6cca332..cb8a42914b 100755 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -660,7 +660,7 @@ void main() { expectExists('android/gradle.properties'); - final String actualContents = await globals.fs.file(projectDir.path + '/android/gradle.properties').readAsString(); + final String actualContents = await globals.fs.file('${projectDir.path}/android/gradle.properties').readAsString(); expect(actualContents.contains('useAndroidX'), true); }); @@ -694,7 +694,7 @@ void main() { expectExists('android/gradle.properties'); - final String actualContents = await globals.fs.file(projectDir.path + '/android/gradle.properties').readAsString(); + final String actualContents = await globals.fs.file('${projectDir.path}/android/gradle.properties').readAsString(); expect(actualContents.contains('useAndroidX'), true); }); @@ -708,13 +708,13 @@ void main() { await runner.run(['create', '--no-pub', '--platforms', 'android', projectDir.path]); final String androidManifest = await globals.fs.file( - projectDir.path + '/android/app/src/main/AndroidManifest.xml' + '${projectDir.path}/android/app/src/main/AndroidManifest.xml' ).readAsString(); expect(androidManifest.contains('android:name="flutterEmbedding"'), true); expect(androidManifest.contains('android:value="2"'), true); final String mainActivity = await globals.fs.file( - projectDir.path + '/android/app/src/main/kotlin/com/example/flutter_project/MainActivity.kt' + '${projectDir.path}/android/app/src/main/kotlin/com/example/flutter_project/MainActivity.kt' ).readAsString(); // Import for the new embedding class. expect(mainActivity.contains('import io.flutter.embedding.android.FlutterActivity'), true); @@ -1090,7 +1090,7 @@ void main() { expectExists('lib/main.dart'); expectExists('test/widget_test.dart'); - final String actualContents = await globals.fs.file(projectDir.path + '/test/widget_test.dart').readAsString(); + final String actualContents = await globals.fs.file('${projectDir.path}/test/widget_test.dart').readAsString(); expect(actualContents.contains('flutter_test.dart'), true); @@ -2254,7 +2254,7 @@ void main() { expect(globals.fs.isFileSync('${projectDir.path}/android/app/build.gradle'), true); - final String buildContent = await globals.fs.file(projectDir.path + '/android/app/build.gradle').readAsString(); + final String buildContent = await globals.fs.file('${projectDir.path}/android/app/build.gradle').readAsString(); expect(buildContent.contains('compileSdkVersion 30'), true); expect(buildContent.contains('targetSdkVersion 30'), true); @@ -2587,7 +2587,7 @@ Future _ensureFlutterToolsSnapshot() async { final File snapshotFile = globals.fs.file(flutterToolsSnapshotPath); if (snapshotFile.existsSync()) { - snapshotFile.renameSync(flutterToolsSnapshotPath + '.bak'); + snapshotFile.renameSync('$flutterToolsSnapshotPath.bak'); } final List snapshotArgs = [ @@ -2615,7 +2615,7 @@ Future _restoreFlutterToolsSnapshot() async { 'flutter_tools.snapshot', )); - final File snapshotBackup = globals.fs.file(flutterToolsSnapshotPath + '.bak'); + final File snapshotBackup = globals.fs.file('$flutterToolsSnapshotPath.bak'); if (!snapshotBackup.existsSync()) { // No backup to restore. return; diff --git a/packages/flutter_tools/test/general.shard/android/adb_log_reader_test.dart b/packages/flutter_tools/test/general.shard/android/adb_log_reader_test.dart index d58d9285b8..b5098cf1db 100644 --- a/packages/flutter_tools/test/general.shard/android/adb_log_reader_test.dart +++ b/packages/flutter_tools/test/general.shard/android/adb_log_reader_test.dart @@ -162,7 +162,7 @@ void main() { completer: Completer.sync(), // Example stack trace from an incorrectly named application:name in the AndroidManfiest.xml stdout: - kDummyLine + + '$kDummyLine' '05-11 12:54:46.665 E/AndroidRuntime(11787): FATAL EXCEPTION: main\n' '05-11 12:54:46.665 E/AndroidRuntime(11787): Process: com.example.foobar, PID: 11787\n' '05-11 12:54:46.665 java.lang.RuntimeException: Unable to instantiate application ' diff --git a/packages/flutter_tools/test/general.shard/base/build_test.dart b/packages/flutter_tools/test/general.shard/base/build_test.dart index 2a77f853f5..243dc8f456 100644 --- a/packages/flutter_tools/test/general.shard/base/build_test.dart +++ b/packages/flutter_tools/test/general.shard/base/build_test.dart @@ -114,7 +114,7 @@ void main() { processManager.addCommand( FakeCommand( command: [ - artifacts.getArtifactPath(Artifact.genSnapshot, platform: TargetPlatform.ios, mode: BuildMode.release) + '_armv7', + '${artifacts.getArtifactPath(Artifact.genSnapshot, platform: TargetPlatform.ios, mode: BuildMode.release)}_armv7', '--additional_arg' ], ), @@ -129,10 +129,15 @@ void main() { }); testWithoutContext('iOS arm64', () async { + final String genSnapshotPath = artifacts.getArtifactPath( + Artifact.genSnapshot, + platform: TargetPlatform.ios, + mode: BuildMode.release, + ); processManager.addCommand( FakeCommand( command: [ - artifacts.getArtifactPath(Artifact.genSnapshot, platform: TargetPlatform.ios, mode: BuildMode.release) + '_arm64', + '${genSnapshotPath}_arm64', '--additional_arg', ], ), @@ -238,11 +243,14 @@ void main() { testWithoutContext('builds iOS with bitcode', () async { final String outputPath = fileSystem.path.join('build', 'foo'); final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S'); + final String genSnapshotPath = artifacts.getArtifactPath( + Artifact.genSnapshot, + platform: TargetPlatform.ios, + mode: BuildMode.profile, + ); processManager.addCommands([ FakeCommand(command: [ - artifacts.getArtifactPath(Artifact.genSnapshot, - platform: TargetPlatform.ios, mode: BuildMode.profile) + - '_armv7', + '${genSnapshotPath}_armv7', '--deterministic', '--snapshot_kind=app-aot-assembly', '--assembly=$assembly', @@ -295,11 +303,14 @@ void main() { final String outputPath = fileSystem.path.join('build', 'foo'); final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S'); final String debugPath = fileSystem.path.join('foo', 'app.ios-armv7.symbols'); + final String genSnapshotPath = artifacts.getArtifactPath( + Artifact.genSnapshot, + platform: TargetPlatform.ios, + mode: BuildMode.profile, + ); processManager.addCommands([ FakeCommand(command: [ - artifacts.getArtifactPath(Artifact.genSnapshot, - platform: TargetPlatform.ios, mode: BuildMode.profile) + - '_armv7', + '${genSnapshotPath}_armv7', '--deterministic', '--snapshot_kind=app-aot-assembly', '--assembly=$assembly', @@ -352,11 +363,14 @@ void main() { testWithoutContext('builds iOS armv7 snapshot with obfuscate', () async { final String outputPath = fileSystem.path.join('build', 'foo'); final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S'); + final String genSnapshotPath = artifacts.getArtifactPath( + Artifact.genSnapshot, + platform: TargetPlatform.ios, + mode: BuildMode.profile, + ); processManager.addCommands([ FakeCommand(command: [ - artifacts.getArtifactPath(Artifact.genSnapshot, - platform: TargetPlatform.ios, mode: BuildMode.profile) + - '_armv7', + '${genSnapshotPath}_armv7', '--deterministic', '--snapshot_kind=app-aot-assembly', '--assembly=$assembly', @@ -408,11 +422,14 @@ void main() { testWithoutContext('builds iOS armv7 snapshot', () async { final String outputPath = fileSystem.path.join('build', 'foo'); + final String genSnapshotPath = artifacts.getArtifactPath( + Artifact.genSnapshot, + platform: TargetPlatform.ios, + mode: BuildMode.release, + ); processManager.addCommands([ FakeCommand(command: [ - artifacts.getArtifactPath(Artifact.genSnapshot, - platform: TargetPlatform.ios, mode: BuildMode.release) + - '_armv7', + '${genSnapshotPath}_armv7', '--deterministic', '--snapshot_kind=app-aot-assembly', '--assembly=${fileSystem.path.join(outputPath, 'snapshot_assembly.S')}', @@ -462,11 +479,14 @@ void main() { testWithoutContext('builds iOS arm64 snapshot', () async { final String outputPath = fileSystem.path.join('build', 'foo'); + final String genSnapshotPath = artifacts.getArtifactPath( + Artifact.genSnapshot, + platform: TargetPlatform.ios, + mode: BuildMode.release, + ); processManager.addCommands([ FakeCommand(command: [ - artifacts.getArtifactPath(Artifact.genSnapshot, - platform: TargetPlatform.ios, mode: BuildMode.release) + - '_arm64', + '${genSnapshotPath}_arm64', '--deterministic', '--snapshot_kind=app-aot-assembly', '--assembly=${fileSystem.path.join(outputPath, 'snapshot_assembly.S')}', diff --git a/packages/flutter_tools/test/general.shard/base/terminal_test.dart b/packages/flutter_tools/test/general.shard/base/terminal_test.dart index 883631db50..7ba6d4ad7e 100644 --- a/packages/flutter_tools/test/general.shard/base/terminal_test.dart +++ b/packages/flutter_tools/test/general.shard/base/terminal_test.dart @@ -19,7 +19,7 @@ void main() { ); bufferLogger.printStatus('0123456789' * 8); - expect(bufferLogger.statusText, equals(('0123456789' * 4 + '\n') * 2)); + expect(bufferLogger.statusText, equals(('${'0123456789' * 4}\n') * 2)); }); testWithoutContext('can turn off wrapping', () async { diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart index 90dde14d83..562314962d 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart @@ -78,17 +78,18 @@ void main() { ..createSync(recursive: true) ..writeAsStringSync('{"configVersion": 2, "packages":[]}'); final String build = androidEnvironment.buildDir.path; + final String flutterPatchedSdkPath = artifacts.getArtifactPath( + Artifact.flutterPatchedSdkPath, + platform: TargetPlatform.android_arm, + mode: BuildMode.profile, + ); processManager.addCommands([ FakeCommand(command: [ artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, '--disable-dart-dev', artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk), '--sdk-root', - artifacts.getArtifactPath( - Artifact.flutterPatchedSdkPath, - platform: TargetPlatform.android_arm, - mode: BuildMode.profile, - ) + '/', + '$flutterPatchedSdkPath/', '--target=flutter', '--no-print-incremental-dependencies', ...buildModeOptions(BuildMode.profile, []), @@ -113,17 +114,18 @@ void main() { ..createSync(recursive: true) ..writeAsStringSync('{"configVersion": 2, "packages":[]}'); final String build = androidEnvironment.buildDir.path; + final String flutterPatchedSdkPath = artifacts.getArtifactPath( + Artifact.flutterPatchedSdkPath, + platform: TargetPlatform.android_arm, + mode: BuildMode.profile, + ); processManager.addCommands([ FakeCommand(command: [ artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, '--disable-dart-dev', artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk), '--sdk-root', - artifacts.getArtifactPath( - Artifact.flutterPatchedSdkPath, - platform: TargetPlatform.android_arm, - mode: BuildMode.profile, - ) + '/', + '$flutterPatchedSdkPath/', '--target=flutter', '--no-print-incremental-dependencies', ...buildModeOptions(BuildMode.profile, []), @@ -149,17 +151,18 @@ void main() { ..createSync(recursive: true) ..writeAsStringSync('{"configVersion": 2, "packages":[]}'); final String build = androidEnvironment.buildDir.path; + final String flutterPatchedSdkPath = artifacts.getArtifactPath( + Artifact.flutterPatchedSdkPath, + platform: TargetPlatform.android_arm, + mode: BuildMode.profile, + ); processManager.addCommands([ FakeCommand(command: [ artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, '--disable-dart-dev', artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk), '--sdk-root', - artifacts.getArtifactPath( - Artifact.flutterPatchedSdkPath, - platform: TargetPlatform.android_arm, - mode: BuildMode.profile, - ) + '/', + '$flutterPatchedSdkPath/', '--target=flutter', '--no-print-incremental-dependencies', ...buildModeOptions(BuildMode.profile, []), @@ -186,17 +189,18 @@ void main() { ..createSync(recursive: true) ..writeAsStringSync('{"configVersion": 2, "packages":[]}'); final String build = androidEnvironment.buildDir.path; + final String flutterPatchedSdkPath = artifacts.getArtifactPath( + Artifact.flutterPatchedSdkPath, + platform: TargetPlatform.android_arm, + mode: BuildMode.profile, + ); processManager.addCommands([ FakeCommand(command: [ artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, '--disable-dart-dev', artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk), '--sdk-root', - artifacts.getArtifactPath( - Artifact.flutterPatchedSdkPath, - platform: TargetPlatform.android_arm, - mode: BuildMode.profile, - ) + '/', + '$flutterPatchedSdkPath/', '--target=flutter', '--no-print-incremental-dependencies', ...buildModeOptions(BuildMode.profile, []), @@ -225,17 +229,18 @@ void main() { ..createSync(recursive: true) ..writeAsStringSync('{"configVersion": 2, "packages":[]}'); final String build = androidEnvironment.buildDir.path; + final String flutterPatchedSdkPath = artifacts.getArtifactPath( + Artifact.flutterPatchedSdkPath, + platform: TargetPlatform.android_arm, + mode: BuildMode.debug, + ); processManager.addCommands([ FakeCommand(command: [ artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, '--disable-dart-dev', artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk), '--sdk-root', - artifacts.getArtifactPath( - Artifact.flutterPatchedSdkPath, - platform: TargetPlatform.android_arm, - mode: BuildMode.debug, - ) + '/', + '$flutterPatchedSdkPath/', '--target=flutter', '--no-print-incremental-dependencies', ...buildModeOptions(BuildMode.debug, []), @@ -262,17 +267,18 @@ void main() { ..createSync(recursive: true) ..writeAsStringSync('{"configVersion": 2, "packages":[]}'); final String build = androidEnvironment.buildDir.path; + final String flutterPatchedSdkPath = artifacts.getArtifactPath( + Artifact.flutterPatchedSdkPath, + platform: TargetPlatform.darwin, + mode: BuildMode.debug, + ); processManager.addCommands([ FakeCommand(command: [ artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, '--disable-dart-dev', artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk), '--sdk-root', - artifacts.getArtifactPath( - Artifact.flutterPatchedSdkPath, - platform: TargetPlatform.darwin, - mode: BuildMode.debug, - ) + '/', + '$flutterPatchedSdkPath/', '--target=flutter', '--no-print-incremental-dependencies', ...buildModeOptions(BuildMode.debug, []), @@ -311,17 +317,18 @@ void main() { logger: logger, ); final String build = testEnvironment.buildDir.path; + final String flutterPatchedSdkPath = artifacts.getArtifactPath( + Artifact.flutterPatchedSdkPath, + platform: TargetPlatform.android_arm, + mode: BuildMode.debug, + ); processManager.addCommands([ FakeCommand(command: [ artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, '--disable-dart-dev', artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk), '--sdk-root', - artifacts.getArtifactPath( - Artifact.flutterPatchedSdkPath, - platform: TargetPlatform.android_arm, - mode: BuildMode.debug, - ) + '/', + '$flutterPatchedSdkPath/', '--target=flutter', '--no-print-incremental-dependencies', ...buildModeOptions(BuildMode.debug, []), diff --git a/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart b/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart index c30602a72c..3cf6171ee3 100644 --- a/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart +++ b/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart @@ -68,8 +68,8 @@ void main() { final Directory installedDirectory = fileSystem.directory(installPath); installedDirectory.createSync(recursive: true); // Create plugin JAR file for Flutter and Dart plugin. - createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); - createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem); + createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); + createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem); final Iterable installed = IntelliJValidatorOnLinux.installed( fileSystem: fileSystem, @@ -95,8 +95,8 @@ void main() { final Directory installedDirectory = fileSystem.directory(installPath); installedDirectory.createSync(recursive: true); // Create plugin JAR file for Flutter and Dart plugin. - createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); - createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem); + createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); + createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem); final Iterable installed = IntelliJValidatorOnLinux.installed( fileSystem: fileSystem, @@ -122,8 +122,8 @@ void main() { final Directory installedDirectory = fileSystem.directory(installPath); installedDirectory.createSync(recursive: true); // Create plugin JAR file for Flutter and Dart plugin. - createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); - createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem); + createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); + createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem); final Iterable installed = IntelliJValidatorOnLinux.installed( fileSystem: fileSystem, @@ -149,8 +149,8 @@ void main() { final Directory installedDirectory = fileSystem.directory(installPath); installedDirectory.createSync(recursive: true); // Create plugin JAR file for Flutter and Dart plugin. - createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); - createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem); + createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); + createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem); final Iterable installed = IntelliJValidatorOnLinux.installed( fileSystem: fileSystem, @@ -175,8 +175,8 @@ void main() { .writeAsStringSync(installPath, flush: true); final Directory installedDirectory = fileSystem.directory(installPath); installedDirectory.createSync(recursive: true); - createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); - createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem); + createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0'); + createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem); final Iterable installed = IntelliJValidatorOnWindows.installed( fileSystem: fileSystem, diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart index 08c3aed8a1..4ba422c427 100644 --- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart @@ -2101,7 +2101,7 @@ void main() { .uri.toString()); expect(residentCompiler.targetModel, TargetModel.dartdevc); expect(residentCompiler.sdkRoot, - globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path + '/'); + '${globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path}/'); expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelDill'); }, overrides: { Artifacts: () => Artifacts.test(), @@ -2132,7 +2132,7 @@ void main() { .uri.toString()); expect(residentCompiler.targetModel, TargetModel.dartdevc); expect(residentCompiler.sdkRoot, - globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path + '/'); + '${globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path}/'); expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformSoundKernelDill'); }, overrides: { Artifacts: () => Artifacts.test(), diff --git a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart index 614d71d54d..0f1ed32b1a 100644 --- a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart +++ b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart @@ -950,7 +950,7 @@ void main() { expect(terminalHandler.logger.statusText, equals('')); terminalHandler.logger.printStatus(message); - expect(terminalHandler.logger.statusText, equals(message + '\n')); // printStatus makes a newline + expect(terminalHandler.logger.statusText, equals('$message\n')); // printStatus makes a newline await terminalHandler.processTerminalInput('c'); expect(terminalHandler.logger.statusText, equals('')); diff --git a/packages/flutter_tools/test/general.shard/utils_test.dart b/packages/flutter_tools/test/general.shard/utils_test.dart index a858e99004..a80f2b8ac6 100644 --- a/packages/flutter_tools/test/general.shard/utils_test.dart +++ b/packages/flutter_tools/test/general.shard/utils_test.dart @@ -75,17 +75,17 @@ baz=qux const int _lineLength = 40; const String _longLine = 'This is a long line that needs to be wrapped.'; final String _longLineWithNewlines = 'This is a long line with newlines that\n' - 'needs to be wrapped.\n\n' + - '0123456789' * 5; + 'needs to be wrapped.\n\n' + '${'0123456789' * 5}'; final String _longAnsiLineWithNewlines = '${AnsiTerminal.red}This${AnsiTerminal.resetAll} is a long line with newlines that\n' 'needs to be wrapped.\n\n' - '${AnsiTerminal.green}0123456789${AnsiTerminal.resetAll}' + - '0123456789' * 3 + + '${AnsiTerminal.green}0123456789${AnsiTerminal.resetAll}' + '${'0123456789' * 3}' '${AnsiTerminal.green}0123456789${AnsiTerminal.resetAll}'; const String _onlyAnsiSequences = '${AnsiTerminal.red}${AnsiTerminal.resetAll}'; final String _indentedLongLineWithNewlines = ' This is an indented long line with newlines that\n' - 'needs to be wrapped.\n\tAnd preserves tabs.\n \n ' + - '0123456789' * 5; + 'needs to be wrapped.\n\tAnd preserves tabs.\n \n ' + '${'0123456789' * 5}'; const String _shortLine = 'Short line.'; const String _indentedLongLine = ' This is an indented long line that needs to be ' 'wrapped and indentation preserved.'; @@ -135,7 +135,7 @@ wrapped.''')); }); testWithoutContext('refuses to wrap to a column smaller than 10 characters', () { - expect(wrapText('$_longLine ' + '0123456789' * 4, columnWidth: 1, shouldWrap: true), equals(''' + expect(wrapText('$_longLine ${'0123456789' * 4}', columnWidth: 1, shouldWrap: true), equals(''' This is a long line that needs @@ -252,7 +252,7 @@ needs to be wrapped. testWithoutContext('', () { expect(wrapText( - ' ' * 7 + 'abc def ghi', columnWidth: 20, hangingIndent: 5, indent: 3, shouldWrap: true), + '${' ' * 7}abc def ghi', columnWidth: 20, hangingIndent: 5, indent: 3, shouldWrap: true), equals( ' abc def\n' ' ghi' diff --git a/packages/flutter_tools/test/general.shard/web/golden_comparator_process_test.dart b/packages/flutter_tools/test/general.shard/web/golden_comparator_process_test.dart index e11e46eaaf..cab59d11c4 100644 --- a/packages/flutter_tools/test/general.shard/web/golden_comparator_process_test.dart +++ b/packages/flutter_tools/test/general.shard/web/golden_comparator_process_test.dart @@ -39,7 +39,7 @@ void main() { 'message': 'some message', }; - final FakeProcess mockProcess = createFakeProcess(jsonEncode(expectedResponse) + '\n'); + final FakeProcess mockProcess = createFakeProcess('${jsonEncode(expectedResponse)}\n'); final MemoryIOSink ioSink = mockProcess.stdin as MemoryIOSink; final TestGoldenComparatorProcess process = TestGoldenComparatorProcess(mockProcess, logger: BufferLogger.test()); @@ -62,7 +62,7 @@ void main() { 'message': 'some other message', }; - final FakeProcess mockProcess = createFakeProcess(jsonEncode(expectedResponse1) + '\n' + jsonEncode(expectedResponse2) + '\n'); + final FakeProcess mockProcess = createFakeProcess('${jsonEncode(expectedResponse1)}\n${jsonEncode(expectedResponse2)}\n'); final MemoryIOSink ioSink = mockProcess.stdin as MemoryIOSink; final TestGoldenComparatorProcess process = TestGoldenComparatorProcess(mockProcess, logger: BufferLogger.test()); diff --git a/packages/flutter_tools/test/general.shard/web/golden_comparator_test.dart b/packages/flutter_tools/test/general.shard/web/golden_comparator_test.dart index 78b8de0c50..e459d5b88a 100644 --- a/packages/flutter_tools/test/general.shard/web/golden_comparator_test.dart +++ b/packages/flutter_tools/test/general.shard/web/golden_comparator_test.dart @@ -45,7 +45,7 @@ void main() { '--non-interactive', '--packages=.dart_tool/package_config.json', 'compiler_output' - ], stdout: jsonEncode(expectedResponse) + '\n', + ], stdout: '${jsonEncode(expectedResponse)}\n', )); final TestGoldenComparator comparator = TestGoldenComparator( @@ -73,7 +73,7 @@ void main() { '--non-interactive', '--packages=.dart_tool/package_config.json', 'compiler_output' - ], stdout: jsonEncode(expectedResponse) + '\n', + ], stdout: '${jsonEncode(expectedResponse)}\n', )); final TestGoldenComparator comparator = TestGoldenComparator( @@ -105,7 +105,7 @@ void main() { '--non-interactive', '--packages=.dart_tool/package_config.json', 'compiler_output' - ], stdout: jsonEncode(expectedResponse1) + '\n' + jsonEncode(expectedResponse2) + '\n', + ], stdout: '${jsonEncode(expectedResponse1)}\n${jsonEncode(expectedResponse2)}\n', )); final TestGoldenComparator comparator = TestGoldenComparator( @@ -140,7 +140,7 @@ void main() { '--non-interactive', '--packages=.dart_tool/package_config.json', 'compiler_output' - ], stdout: jsonEncode(expectedResponse1) + '\n', + ], stdout: '${jsonEncode(expectedResponse1)}\n', )); processManager.addCommand(FakeCommand( command: const [ @@ -149,7 +149,7 @@ void main() { '--non-interactive', '--packages=.dart_tool/package_config.json', 'compiler_output' - ], stdout: jsonEncode(expectedResponse2) + '\n', + ], stdout: '${jsonEncode(expectedResponse2)}\n', )); final TestGoldenComparator comparator = TestGoldenComparator( @@ -182,7 +182,7 @@ void main() { '--non-interactive', '--packages=.dart_tool/package_config.json', 'compiler_output' - ], stdout: jsonEncode(expectedResponse) + '\n', + ], stdout: '${jsonEncode(expectedResponse)}\n', stdin: stdin, )); diff --git a/packages/flutter_tools/test/integration.shard/generated_plugin_registrant_test.dart b/packages/flutter_tools/test/integration.shard/generated_plugin_registrant_test.dart index d640136e6e..df491ea312 100644 --- a/packages/flutter_tools/test/integration.shard/generated_plugin_registrant_test.dart +++ b/packages/flutter_tools/test/integration.shard/generated_plugin_registrant_test.dart @@ -126,7 +126,7 @@ Future _ensureFlutterToolsSnapshot() async { final File snapshotFile = globals.fs.file(flutterToolsSnapshotPath); if (snapshotFile.existsSync()) { - snapshotFile.renameSync(flutterToolsSnapshotPath + '.bak'); + snapshotFile.renameSync('$flutterToolsSnapshotPath.bak'); } final List snapshotArgs = [ @@ -157,7 +157,7 @@ Future _restoreFlutterToolsSnapshot() async { ); final File snapshotBackup = - globals.fs.file(flutterToolsSnapshotPath + '.bak'); + globals.fs.file('$flutterToolsSnapshotPath.bak'); if (!snapshotBackup.existsSync()) { // No backup to restore. return; diff --git a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart index 02fc9b1d6e..447eeab042 100644 --- a/packages/flutter_tools/test/integration.shard/overall_experience_test.dart +++ b/packages/flutter_tools/test/integration.shard/overall_experience_test.dart @@ -113,7 +113,7 @@ class Multiple extends Transition { @override String toString() { - return _originalPatterns.map(describe).join(', ') + ' (matched ${_originalPatterns.length - patterns.length} so far)'; + return '${_originalPatterns.map(describe).join(', ')} (matched ${_originalPatterns.length - patterns.length} so far)'; } } diff --git a/packages/flutter_tools/test/integration.shard/test_driver.dart b/packages/flutter_tools/test/integration.shard/test_driver.dart index 44414c3e83..8b91933742 100644 --- a/packages/flutter_tools/test/integration.shard/test_driver.dart +++ b/packages/flutter_tools/test/integration.shard/test_driver.dart @@ -68,11 +68,11 @@ abstract class FlutterTestDriver { String lastTime = ''; void _debugPrint(String message, { String topic = '' }) { const int maxLength = 2500; - final String truncatedMessage = message.length > maxLength ? message.substring(0, maxLength) + '...' : message; + final String truncatedMessage = message.length > maxLength ? '${message.substring(0, maxLength)}...' : message; final String line = '${topic.padRight(10)} $truncatedMessage'; _allMessages.add(line); final int timeInSeconds = DateTime.now().difference(startTime).inSeconds; - String time = timeInSeconds.toString().padLeft(5) + 's '; + String time = '${timeInSeconds.toString().padLeft(5)}s '; if (time == lastTime) { time = ' ' * time.length; } else { diff --git a/packages/flutter_tools/test/integration.shard/test_test.dart b/packages/flutter_tools/test/integration.shard/test_test.dart index d7575e2056..0251128210 100644 --- a/packages/flutter_tools/test/integration.shard/test_test.dart +++ b/packages/flutter_tools/test/integration.shard/test_test.dart @@ -194,7 +194,7 @@ void main() { }); testWithoutContext('flutter test should run all tests inside of a directory with no trailing slash', () async { - final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, flutterTestDirectory + '/child_directory', + final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, '$flutterTestDirectory/child_directory', extraArguments: const ['--verbose']); final String stdout = result.stdout as String; if ((!stdout.contains('+2: All tests passed')) || diff --git a/packages/flutter_tools/test/src/fake_http_client.dart b/packages/flutter_tools/test/src/fake_http_client.dart index e9b39c9f2f..707f607285 100644 --- a/packages/flutter_tools/test/src/fake_http_client.dart +++ b/packages/flutter_tools/test/src/fake_http_client.dart @@ -410,7 +410,7 @@ class _FakeHttpClientRequest implements HttpClientRequest { @override void writeln([Object? object = '']) { - _body.addAll(utf8.encode(object.toString() + '\n')); + _body.addAll(utf8.encode('$object\n')); } } diff --git a/packages/flutter_tools/test/src/pubspec_schema.dart b/packages/flutter_tools/test/src/pubspec_schema.dart index e91a179876..1b80a87a18 100644 --- a/packages/flutter_tools/test/src/pubspec_schema.dart +++ b/packages/flutter_tools/test/src/pubspec_schema.dart @@ -18,7 +18,7 @@ void validatePubspecForPlugin({ String? webFileName, }) { final FlutterManifest manifest = - FlutterManifest.createFromPath(projectDir + '/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger)!; + FlutterManifest.createFromPath('$projectDir/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger)!; final YamlMap platformsMap = YamlMap.wrap(manifest.supportedPlatforms!); for (final String platform in expectedPlatforms) { expect(platformsMap[platform], isNotNull);