Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit d40ee21

Browse files
authored
remove unnecessary .toString() (#103226)
1 parent a1a46c9 commit d40ee21

File tree

29 files changed

+58
-58
lines changed

29 files changed

+58
-58
lines changed

dev/bots/prepare_package.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ class ProcessRunner {
160160
}
161161
} on ProcessException catch (e) {
162162
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
163-
'failed with:\n${e.toString()}';
163+
'failed with:\n$e';
164164
throw PreparePackageException(message);
165165
} on ArgumentError catch (e) {
166166
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
167-
'failed with:\n${e.toString()}';
167+
'failed with:\n$e';
168168
throw PreparePackageException(message);
169169
}
170170

dev/bots/test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ Future<void> _dartRunTest(String workingDirectory, {
16541654
if (coverage != null)
16551655
'--coverage=$coverage',
16561656
if (perTestTimeout != null)
1657-
'--timeout=${perTestTimeout.inMilliseconds.toString()}ms',
1657+
'--timeout=${perTestTimeout.inMilliseconds}ms',
16581658
if (testPaths != null)
16591659
for (final String testPath in testPaths)
16601660
testPath,

dev/bots/unpublish_package.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ class ProcessRunner {
190190
}
191191
} on ProcessException catch (e) {
192192
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
193-
'failed with:\n${e.toString()}';
193+
'failed with:\n$e';
194194
throw UnpublishException(message);
195195
} on ArgumentError catch (e) {
196196
final String message = 'Running "${commandLine.join(' ')}" in ${workingDirectory.path} '
197-
'failed with:\n${e.toString()}';
197+
'failed with:\n$e';
198198
throw UnpublishException(message);
199199
}
200200

dev/conductor/core/lib/src/version.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,14 @@ class Version {
278278
final String branchX = branchMatch.group(1)!;
279279
if (x != int.tryParse(branchX)) {
280280
throw ConductorException(
281-
'Parsed version ${toString()} has a different x value than candidate '
281+
'Parsed version $this has a different x value than candidate '
282282
'branch $candidateBranch',
283283
);
284284
}
285285
final String branchY = branchMatch.group(2)!;
286286
if (y != int.tryParse(branchY)) {
287287
throw ConductorException(
288-
'Parsed version ${toString()} has a different y value than candidate '
288+
'Parsed version $this has a different y value than candidate '
289289
'branch $candidateBranch',
290290
);
291291
}
@@ -295,7 +295,7 @@ class Version {
295295
final String branchM = branchMatch.group(3)!;
296296
if (m != int.tryParse(branchM)) {
297297
throw ConductorException(
298-
'Parsed version ${toString()} has a different m value than candidate '
298+
'Parsed version $this has a different m value than candidate '
299299
'branch $candidateBranch with type $type',
300300
);
301301
}

dev/devicelab/lib/framework/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ void checkDirectoryNotExists(String directory) {
758758
void checkCollectionContains<T>(Iterable<T> values, Iterable<T> collection) {
759759
for (final T value in values) {
760760
if (!collection.contains(value)) {
761-
throw TaskResult.failure('Expected to find `$value` in `${collection.toString()}`.');
761+
throw TaskResult.failure('Expected to find `$value` in `$collection`.');
762762
}
763763
}
764764
}

dev/integration_tests/android_views/lib/motion_events_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
189189
if (!mounted) {
190190
return;
191191
}
192-
showMessage(context, 'Failed saving ${e.toString()}');
192+
showMessage(context, 'Failed saving $e');
193193
}
194194
}
195195

@@ -309,6 +309,6 @@ class TouchEventDiff extends StatelessWidget {
309309
for (int i = 0; i < coords.length; i++) {
310310
buffer.write('p$i x: ${coords[i]['x']} y: ${coords[i]['y']}, pressure: ${coords[i]['pressure']} ');
311311
}
312-
print(buffer.toString());
312+
print(buffer);
313313
}
314314
}

dev/integration_tests/flutter_gallery/lib/demo/material/icons_demo.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class _IconsDemoCard extends StatelessWidget {
101101
TableRow _buildIconRow(double size) {
102102
return TableRow(
103103
children: <Widget> [
104-
_centeredText('${size.floor().toString()} ${icon.toString()}'),
104+
_centeredText('${size.floor()} $icon'),
105105
_buildIconButton(size, icon, true),
106106
_buildIconButton(size, icon, false),
107107
],
@@ -122,9 +122,9 @@ class _IconsDemoCard extends StatelessWidget {
122122
children: <TableRow> [
123123
TableRow(
124124
children: <Widget> [
125-
_centeredText('Size ${icon.toString()}'),
126-
_centeredText('Enabled ${icon.toString()}'),
127-
_centeredText('Disabled ${icon.toString()}'),
125+
_centeredText('Size $icon'),
126+
_centeredText('Enabled $icon'),
127+
_centeredText('Disabled $icon'),
128128
]
129129
),
130130
_buildIconRow(18.0),

dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
171171
if (!mounted) {
172172
return;
173173
}
174-
showMessage(context, 'Failed saving ${e.toString()}');
174+
showMessage(context, 'Failed saving $e');
175175
}
176176
}
177177

@@ -281,6 +281,6 @@ class TouchEventDiff extends StatelessWidget {
281281
for (int i = 0; i < coords.length; i++) {
282282
buffer.write('p$i x: ${coords[i]['x']} y: ${coords[i]['y']}, pressure: ${coords[i]['pressure']} ');
283283
}
284-
print(buffer.toString());
284+
print(buffer);
285285
}
286286
}

dev/tools/examples_smoke_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ Future<String> runCommand(
228228
);
229229
} on ProcessException catch (e) {
230230
stderr.writeln('Running "${cmd.join(' ')}" in ${workingDirectory.path} '
231-
'failed with:\n${e.toString()}');
231+
'failed with:\n$e');
232232
exitCode = 2;
233233
return utf8.decode(stdoutOutput);
234234
} on ArgumentError catch (e) {
235235
stderr.writeln('Running "${cmd.join(' ')}" in ${workingDirectory.path} '
236-
'failed with:\n${e.toString()}');
236+
'failed with:\n$e');
237237
exitCode = 3;
238238
return utf8.decode(stdoutOutput);
239239
}

dev/tools/gen_defaults/lib/template.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,6 @@ abstract class TokenTemplate {
149149

150150
/// Generate a [TextTheme] text style name for the given component token.
151151
String textStyle(String componentToken) {
152-
return '$textThemePrefix${tokens["$componentToken.text-style"]!.toString()}';
152+
return '$textThemePrefix${tokens["$componentToken.text-style"]}';
153153
}
154154
}

0 commit comments

Comments
 (0)