enable lint prefer_interpolation_to_compose_strings (#83407)

This commit is contained in:
Alexandre Ardhuin 2021-06-01 20:14:06 +02:00 committed by GitHub
parent 71e711547f
commit 34059eec2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 367 additions and 345 deletions

View file

@ -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

View file

@ -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';
}
}

View file

@ -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<String>(stock.symbol),
onTap: _getHandler(onPressed),

View file

@ -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(

View file

@ -243,8 +243,8 @@ Future<void> 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, '<!DOCTYPE HTML>\n<!-- ${_generateLicense('')} -->', trailingBlank: false);
await _verifyNoMissingLicenseForExtension(workingDirectory, 'xml', overrideMinimumMatches ?? 1, '<!-- ${_generateLicense('')} -->');
@ -252,7 +252,7 @@ Future<void> verifyNoMissingLicense(String workingDirectory, { bool checkMinimum
Future<void> _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<String> errors = <String>[];
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<void> verifyNoBadImportsInFlutter(String workingDirectory) async {
.map<String>((Directory entity) => path.basename(entity.path))
.toList()..sort();
if (!_listEquals<String>(packages, directories)) {
errors.add(
'flutter/lib/*.dart does not match flutter/lib/src/*/:\n'
'These are the exported packages:\n' +
packages.map<String>((String path) => ' lib/$path.dart').join('\n') +
'These are the directories:\n' +
directories.map<String>((String path) => ' lib/src/$path/').join('\n')
);
errors.add(<String>[
'flutter/lib/*.dart does not match flutter/lib/src/*/:',
'These are the exported packages:',
...packages.map<String>((String path) => ' lib/$path.dart'),
'These are the directories:',
...directories.map<String>((String path) => ' lib/src/$path/')
].join('\n'));
}
// Verify that the imports are well-ordered.
final Map<String, Set<String>> dependencyMap = <String, Set<String>>{};
@ -347,7 +347,7 @@ Future<void> 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<void> verifyNoBadImportsInFlutter(String workingDirectory) async {
for (final String package in dependencyMap.keys) {
final List<String> loop = _deepSearch<String>(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

View file

@ -636,7 +636,7 @@ Future<void> _runFrameworkTests() async {
await _runFlutterTest(
path.join(flutterRoot, 'packages', 'flutter'),
options: <String>['--dart-define=dart.vm.product=true', ...soundNullSafetyOptions],
tests: <String>[ 'test_release' + path.separator ],
tests: <String>['test_release${path.separator}'],
);
}

View file

@ -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 = <String>[
'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 = <String>[
'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'
);
});

View file

@ -224,7 +224,7 @@ Future<void> 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 {

View file

@ -445,7 +445,7 @@ Future<ProcessResult> _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'

View file

@ -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));
}

View file

@ -148,7 +148,7 @@ Iterable<RunningProcessInfo> 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);

View file

@ -564,7 +564,8 @@ T requireConfigProperty<T>(Map<String, dynamic> 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<void> getNewGallery(String revision, Directory galleryDir) async {

View file

@ -95,7 +95,7 @@ TaskFunction createHotModeTest({String deviceIdOverride, Map<String, String> 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;

View file

@ -1004,7 +1004,7 @@ class WebCompileTest {
sizeMetrics['${metric}_dart2js_size'] = _parseDu(result.stdout as String);
await Process.run('gzip',<String>['-k', '9', fileName]);
final ProcessResult resultGzip = await Process.run('du', <String>['-k', fileName + '.gz']);
final ProcessResult resultGzip = await Process.run('du', <String>['-k', '$fileName.gz']);
sizeMetrics['${metric}_dart2js_size_gzip'] = _parseDu(resultGzip.stdout as String);
return sizeMetrics;

View file

@ -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);
});

View file

@ -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:

View file

@ -220,7 +220,8 @@ class _ChipDemoState extends State<ChipDemo> {
if (_selectedAction.isEmpty) {
return '';
}
return _capitalize(_results[_selectedAction]!) + '!';
final String value = _capitalize(_results[_selectedAction]!);
return '$value!';
}
@override

View file

@ -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++;
}

View file

@ -457,7 +457,8 @@ class _FuzzerState extends State<Fuzzer> 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<Painting> 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<String>((int index) => 'U+' + index.toRadixString(16).padLeft(4, '0')).join(' '));
debugPrint(_text?.runes.map<String>((int index) {
final String hexa = index.toRadixString(16).padLeft(4, '0');
return 'U+$hexa';
}).join(' '));
setState(() {
_ticker.stop();
});

View file

@ -185,8 +185,10 @@ Future<void> main(List<String> 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<String, dynamic>);
logicalData = LogicalKeyData.fromJson(json.decode(await File(parsedArguments['logical-data'] as String).readAsString()) as Map<String, dynamic>);

View file

@ -37,7 +37,7 @@ Future<Archive?> 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);

View file

@ -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] ??= <String>{};
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<String, dynamic> 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<String, dynamic> 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];

View file

@ -96,9 +96,9 @@ class LocaleInfo implements Comparable<LocaleInfo> {
// 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] ??= <String, String>{};

View file

@ -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;
}

View file

@ -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);

View file

@ -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

View file

@ -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(

View file

@ -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;

View file

@ -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,
/// ),
/// );

View file

@ -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

View file

@ -153,7 +153,7 @@ mixin ServicesBinding on BindingBase, SchedulerBinding {
// This is run in another isolate created by _addLicenses above.
static List<LicenseEntry> _parseLicenses(String rawLicenses) {
final String _licenseSeparator = '\n' + ('-' * 80) + '\n';
final String _licenseSeparator = '\n${'-' * 80}\n';
final List<LicenseEntry> result = <LicenseEntry>[];
final List<String> licenses = rawLicenses.split(_licenseSeparator);
for (final String license in licenses) {

View file

@ -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;

View file

@ -43,7 +43,7 @@ void main() {
test('debugPrint throttling', () {
FakeAsync().run((FakeAsync async) {
List<String> log = captureOutput(() {
debugPrintThrottled('A' * (22 * 1024) + '\nB');
debugPrintThrottled('${'A' * (22 * 1024)}\nB');
});
expect(log.length, 1);
async.elapse(const Duration(seconds: 2));

View file

@ -70,7 +70,7 @@ Widget buildFormFrame({
return DropdownMenuItem<String>(
key: ValueKey<String>(item),
value: item,
child: Text(item, key: ValueKey<String>(item + 'Text')),
child: Text(item, key: ValueKey<String>('${item}Text')),
);
}).toList(),
alignment: buttonAlignment,
@ -292,7 +292,7 @@ void main() {
return DropdownMenuItem<String>(
key: ValueKey<String>(item),
value: item,
child: Text(item, key: ValueKey<String>(item + 'Text')),
child: Text(item, key: ValueKey<String>('${item}Text')),
);
}).toList(),
),

View file

@ -61,7 +61,7 @@ Widget buildDropdown({
return DropdownMenuItem<String>(
key: ValueKey<String>(item),
value: item,
child: Text(item, key: ValueKey<String>(item + 'Text')),
child: Text(item, key: ValueKey<String>('${item}Text')),
);
}).toList();
@ -230,7 +230,7 @@ class _TestAppState extends State<TestApp> {
// The RenderParagraphs should be aligned, i.e. they should have the same
// size and location.
void checkSelectedItemTextGeometry(WidgetTester tester, String value) {
final List<RenderBox> boxes = tester.renderObjectList<RenderBox>(find.byKey(ValueKey<String>(value + 'Text'))).toList();
final List<RenderBox> boxes = tester.renderObjectList<RenderBox>(find.byKey(ValueKey<String>('${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<String>(
key: ValueKey<String>(item),
value: item,
child: Text(item, key: ValueKey<String>(item + 'Text')),
child: Text(item, key: ValueKey<String>('${item}Text')),
);
}).toList(),
);
@ -2566,7 +2566,7 @@ void main() {
return DropdownMenuItem<String>(
key: ValueKey<String>(item),
value: item,
child: Text(item, key: ValueKey<String>(item + 'Text')),
child: Text(item, key: ValueKey<String>('${item}Text')),
);
}).toList(),
);
@ -2818,7 +2818,7 @@ void main() {
return DropdownMenuItem<String>(
key: ValueKey<String>(item),
value: item,
child: Text(item, key: ValueKey<String>(item + 'Text')),
child: Text(item, key: ValueKey<String>('${item}Text')),
);
}).toList(),
);

View file

@ -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 {

View file

@ -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<dynamic, dynamic> methodCall = jsonMessage.decodeMessage(message) as Map<dynamic, dynamic>;
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') {

View file

@ -86,7 +86,7 @@ void main() {
testWidgets('Validator sets the error text only when validate is called', (WidgetTester tester) async {
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
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;
}

View file

@ -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) {

View file

@ -58,7 +58,7 @@ void _tests() {
.split('\n')
.map<String>((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 {

View file

@ -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(<String>[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(<String>[pubRootTest]);
}
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
@ -1231,7 +1229,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final List<String> 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(<String>[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(<String>[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<String> 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', <String, String>{'arg0': pubRootTest});
rootJson = (await service.testExtension('getRootWidgetSummaryTree', <String, String>{'objectGroup': group}))! as Map<String, Object?>;
@ -1704,7 +1702,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final List<String> 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', <String, String>{'arg0': pubRootTest});
summarySelection = (await service.testExtension('getSelectedSummaryWidget', <String, String>{'objectGroup': group}))! as Map<String, Object?>;
@ -1805,7 +1803,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final List<String> 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', <String, String>{'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', <String, String>{'arg0': pubRootFramework});
expect(await service.testExtension('getSelectedWidget', <String, String>{'objectGroup': 'my-group'}), contains('createdByLocalProject'));
service.setSelection(elementA, 'my-group');
@ -1886,7 +1884,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final List<String> 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', <String, String>{'arg0': pubRootTest, 'isolateId': '34'});
service.setSelection(elementA, 'my-group');
@ -1929,8 +1927,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final List<String> 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', <String, String>{'arg0': pubRootTest});
final List<Map<Object, Object?>> rebuildEvents =
@ -2125,8 +2122,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final List<String> 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', <String, String>{'arg0': pubRootTest});
final List<Map<Object, Object?>> repaintEvents =
@ -2861,7 +2857,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
expect(file, endsWith('widget_inspector_test.dart'));
final List<String> 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(<String>[pubRootTest]);
final String summary = service.getRootWidgetSummaryTree('foo1');
@ -3034,8 +3030,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final List<String> 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.

View file

@ -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');
}
}

View file

@ -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);
}

View file

@ -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);

View file

@ -146,7 +146,7 @@ mixin LocalComparisonOutput {
final Map<String, Image> diffs = result.diffs!.cast<String, Image>();
for (final MapEntry<String, Image> 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')),

View file

@ -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');
}
}

View file

@ -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

View file

@ -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'

View file

@ -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) {

View file

@ -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;
},

View file

@ -331,7 +331,7 @@ class SizeAnalyzer {
}
for (; i < localSegments.length; i += 1) {
_logger.printStatus(
localSegments[i] + '/',
'${localSegments[i]}/',
indent: (level + i) * 2,
emphasis: true,
);

View file

@ -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(

View file

@ -86,7 +86,7 @@ class Fingerprint {
final Iterable<File> files = inputPaths.map<File>(fileSystem.file);
final Iterable<File> 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: <String, String>{

View file

@ -422,7 +422,7 @@ class StdoutLogger extends Logger {
@override
void clear() {
_status?.pause();
writeToStdOut(terminal.clearScreen() + '\n');
writeToStdOut('${terminal.clearScreen()}\n');
_status?.resume();
}
}

View file

@ -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');

View file

@ -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);
}

View file

@ -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<String> 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;
}

View file

@ -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);

View file

@ -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<String> prefixedSegments = segments.map((String segment) {
if (!segmentPatternRegex.hasMatch(segment)) {
return 'u' + segment;
return 'u$segment';
}
return segment;
}).toList();

View file

@ -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);
}

View file

@ -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();

View file

@ -938,7 +938,7 @@ String toMultiRootPath(Uri fileUri, String? scheme, List<String> 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();

View file

@ -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

View file

@ -650,7 +650,7 @@ abstract class Device {
// Join columns into lines of text
for (final List<String> row in table) {
yield indices.map<String>((int i) => row[i].padRight(widths[i])).join('') + '${row.last}';
yield indices.map<String>((int i) => row[i].padRight(widths[i])).followedBy(<String>[row.last]).join('');
}
}

View file

@ -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);
}

View file

@ -301,9 +301,9 @@ abstract class Emulator {
return table
.map<String>((List<String> row) {
return indices
.map<String>((int i) => row[i].padRight(widths[i]))
.join('') +
'${row.last}';
.map<String>((int i) => row[i].padRight(widths[i]))
.followedBy(<String>[row.last])
.join('');
})
.map<String>((String line) => line.replaceAll(whiteSpaceAndDots, ''))
.toList();

View file

@ -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');
}
}

View file

@ -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!;
}

View file

@ -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

View file

@ -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,

View file

@ -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(

View file

@ -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>((String license) {
final List<String> packageNames = packageLicenses[license]!.toList()
..sort();
return packageNames.join('\n') + '\n\n' + license;
return '${packageNames.join('\n')}\n\n$license';
}).toList();
combinedLicensesList.sort();

View file

@ -131,7 +131,7 @@ Future<void> _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)

View file

@ -93,10 +93,10 @@ class LocaleInfo implements Comparable<LocaleInfo> {
// Update the base string to reflect assumed scriptCodes.
originalString = languageCode;
if (scriptCode != null) {
originalString += '_' + scriptCode;
originalString += '_$scriptCode';
}
if (countryCode != null) {
originalString += '_' + countryCode;
originalString += '_$countryCode';
}
}

View file

@ -942,7 +942,7 @@ abstract class FlutterCommand extends Command<void> {
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);
}

View file

@ -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) {

View file

@ -221,26 +221,26 @@ class FlutterWebPlatform extends PlatformPlugin {
Future<shelf.Response> _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: <String, String>{
final String generatedFile = '${_fileSystem.path.split(leadingPath).join('_')}.bootstrap.js';
return shelf.Response.ok(generateTestBootstrapFileContents('/$generatedFile', 'require.js', 'dart_stack_trace_mapper.js'), headers: <String, String>{
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: <String, String>{
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: <String, String>{
return shelf.Response.ok(webMemoryFS.files['$path.dart.lib.js'], headers: <String, String>{
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 = '<link rel="x-dart-test" href="$scriptBase">';
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();

View file

@ -82,7 +82,7 @@ class VsCode {
Version? _extensionVersion;
final List<ValidationMessage> _validationMessages = <ValidationMessage>[];
String get productName => 'VS Code' + (edition != null ? ', $edition' : '');
String get productName => 'VS Code${edition != null ? ', $edition' : ''}';
Iterable<ValidationMessage> get validationMessages => _validationMessages;

View file

@ -217,7 +217,7 @@ class GoogleChromeDevice extends ChromiumDevice {
if (result.exitCode == 0) {
final List<String> 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<String> 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]}';
}
}
}

View file

@ -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(<String>['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<void> _ensureFlutterToolsSnapshot() async {
final File snapshotFile = globals.fs.file(flutterToolsSnapshotPath);
if (snapshotFile.existsSync()) {
snapshotFile.renameSync(flutterToolsSnapshotPath + '.bak');
snapshotFile.renameSync('$flutterToolsSnapshotPath.bak');
}
final List<String> snapshotArgs = <String>[
@ -2615,7 +2615,7 @@ Future<void> _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;

View file

@ -162,7 +162,7 @@ void main() {
completer: Completer<void>.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 '

View file

@ -114,7 +114,7 @@ void main() {
processManager.addCommand(
FakeCommand(
command: <String>[
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: <String>[
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>[
FakeCommand(command: <String>[
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>[
FakeCommand(command: <String>[
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>[
FakeCommand(command: <String>[
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>[
FakeCommand(command: <String>[
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>[
FakeCommand(command: <String>[
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')}',

View file

@ -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 {

View file

@ -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>[
FakeCommand(command: <String>[
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, <String>[]),
@ -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>[
FakeCommand(command: <String>[
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, <String>[]),
@ -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>[
FakeCommand(command: <String>[
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, <String>[]),
@ -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>[
FakeCommand(command: <String>[
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, <String>[]),
@ -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>[
FakeCommand(command: <String>[
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, <String>[]),
@ -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>[
FakeCommand(command: <String>[
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, <String>[]),
@ -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>[
FakeCommand(command: <String>[
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, <String>[]),

View file

@ -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<DoctorValidator> 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<DoctorValidator> 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<DoctorValidator> 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<DoctorValidator> 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<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,

View file

@ -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: <Type, Generator>{
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: <Type, Generator>{
Artifacts: () => Artifacts.test(),

View file

@ -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(''));

View file

@ -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'

View file

@ -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());

View file

@ -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 <String>[
@ -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,
));

View file

@ -126,7 +126,7 @@ Future<void> _ensureFlutterToolsSnapshot() async {
final File snapshotFile = globals.fs.file(flutterToolsSnapshotPath);
if (snapshotFile.existsSync()) {
snapshotFile.renameSync(flutterToolsSnapshotPath + '.bak');
snapshotFile.renameSync('$flutterToolsSnapshotPath.bak');
}
final List<String> snapshotArgs = <String>[
@ -157,7 +157,7 @@ Future<void> _restoreFlutterToolsSnapshot() async {
);
final File snapshotBackup =
globals.fs.file(flutterToolsSnapshotPath + '.bak');
globals.fs.file('$flutterToolsSnapshotPath.bak');
if (!snapshotBackup.existsSync()) {
// No backup to restore.
return;

View file

@ -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)';
}
}

View file

@ -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 {

View file

@ -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 <String>['--verbose']);
final String stdout = result.stdout as String;
if ((!stdout.contains('+2: All tests passed')) ||

View file

@ -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'));
}
}

View file

@ -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);