remove unnecessary .toString() (#103226)

This commit is contained in:
Alexandre Ardhuin
2022-05-07 01:04:13 +02:00
committed by GitHub
parent a1a46c96c4
commit d40ee2149c
29 changed files with 58 additions and 58 deletions

View File

@@ -160,11 +160,11 @@ class ProcessRunner {
}
} on ProcessException catch (e) {
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
'failed with:\n${e.toString()}';
'failed with:\n$e';
throw PreparePackageException(message);
} on ArgumentError catch (e) {
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
'failed with:\n${e.toString()}';
'failed with:\n$e';
throw PreparePackageException(message);
}

View File

@@ -1654,7 +1654,7 @@ Future<void> _dartRunTest(String workingDirectory, {
if (coverage != null)
'--coverage=$coverage',
if (perTestTimeout != null)
'--timeout=${perTestTimeout.inMilliseconds.toString()}ms',
'--timeout=${perTestTimeout.inMilliseconds}ms',
if (testPaths != null)
for (final String testPath in testPaths)
testPath,

View File

@@ -190,11 +190,11 @@ class ProcessRunner {
}
} on ProcessException catch (e) {
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
'failed with:\n${e.toString()}';
'failed with:\n$e';
throw UnpublishException(message);
} on ArgumentError catch (e) {
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
'failed with:\n${e.toString()}';
'failed with:\n$e';
throw UnpublishException(message);
}

View File

@@ -278,14 +278,14 @@ class Version {
final String branchX = branchMatch.group(1)!;
if (x != int.tryParse(branchX)) {
throw ConductorException(
'Parsed version ${toString()} has a different x value than candidate '
'Parsed version $this has a different x value than candidate '
'branch $candidateBranch',
);
}
final String branchY = branchMatch.group(2)!;
if (y != int.tryParse(branchY)) {
throw ConductorException(
'Parsed version ${toString()} has a different y value than candidate '
'Parsed version $this has a different y value than candidate '
'branch $candidateBranch',
);
}
@@ -295,7 +295,7 @@ class Version {
final String branchM = branchMatch.group(3)!;
if (m != int.tryParse(branchM)) {
throw ConductorException(
'Parsed version ${toString()} has a different m value than candidate '
'Parsed version $this has a different m value than candidate '
'branch $candidateBranch with type $type',
);
}

View File

@@ -758,7 +758,7 @@ void checkDirectoryNotExists(String directory) {
void checkCollectionContains<T>(Iterable<T> values, Iterable<T> collection) {
for (final T value in values) {
if (!collection.contains(value)) {
throw TaskResult.failure('Expected to find `$value` in `${collection.toString()}`.');
throw TaskResult.failure('Expected to find `$value` in `$collection`.');
}
}
}

View File

@@ -189,7 +189,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
if (!mounted) {
return;
}
showMessage(context, 'Failed saving ${e.toString()}');
showMessage(context, 'Failed saving $e');
}
}
@@ -309,6 +309,6 @@ class TouchEventDiff extends StatelessWidget {
for (int i = 0; i < coords.length; i++) {
buffer.write('p$i x: ${coords[i]['x']} y: ${coords[i]['y']}, pressure: ${coords[i]['pressure']} ');
}
print(buffer.toString());
print(buffer);
}
}

View File

@@ -101,7 +101,7 @@ class _IconsDemoCard extends StatelessWidget {
TableRow _buildIconRow(double size) {
return TableRow(
children: <Widget> [
_centeredText('${size.floor().toString()} ${icon.toString()}'),
_centeredText('${size.floor()} $icon'),
_buildIconButton(size, icon, true),
_buildIconButton(size, icon, false),
],
@@ -122,9 +122,9 @@ class _IconsDemoCard extends StatelessWidget {
children: <TableRow> [
TableRow(
children: <Widget> [
_centeredText('Size ${icon.toString()}'),
_centeredText('Enabled ${icon.toString()}'),
_centeredText('Disabled ${icon.toString()}'),
_centeredText('Size $icon'),
_centeredText('Enabled $icon'),
_centeredText('Disabled $icon'),
]
),
_buildIconRow(18.0),

View File

@@ -171,7 +171,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
if (!mounted) {
return;
}
showMessage(context, 'Failed saving ${e.toString()}');
showMessage(context, 'Failed saving $e');
}
}
@@ -281,6 +281,6 @@ class TouchEventDiff extends StatelessWidget {
for (int i = 0; i < coords.length; i++) {
buffer.write('p$i x: ${coords[i]['x']} y: ${coords[i]['y']}, pressure: ${coords[i]['pressure']} ');
}
print(buffer.toString());
print(buffer);
}
}

View File

@@ -228,12 +228,12 @@ Future<String> runCommand(
);
} on ProcessException catch (e) {
stderr.writeln('Running "${cmd.join(' ')}" in ${workingDirectory.path} '
'failed with:\n${e.toString()}');
'failed with:\n$e');
exitCode = 2;
return utf8.decode(stdoutOutput);
} on ArgumentError catch (e) {
stderr.writeln('Running "${cmd.join(' ')}" in ${workingDirectory.path} '
'failed with:\n${e.toString()}');
'failed with:\n$e');
exitCode = 3;
return utf8.decode(stdoutOutput);
}

View File

@@ -149,6 +149,6 @@ abstract class TokenTemplate {
/// Generate a [TextTheme] text style name for the given component token.
String textStyle(String componentToken) {
return '$textThemePrefix${tokens["$componentToken.text-style"]!.toString()}';
return '$textThemePrefix${tokens["$componentToken.text-style"]}';
}
}

View File

@@ -419,7 +419,7 @@ void _generateIconDemo(File demoFilePath, Map<String, String> tokenPairMap) {
home: Scaffold(
body: Wrap(
children: const [
${newIconUsages.toString()}
$newIconUsages
],
),
),