mirror of
https://github.com/flutter/packages.git
synced 2025-08-24 11:39:26 +08:00
[flutter_plugin_tools] Work around banner in drive-examples (#4142)
* [flutter_plugin_tools] Work around banner in drive-examples Strip off any unexpected output before parsing `flutter devices --machine` output. Works around a bug in the Flutter tool that can result in banners being printed in `--machine` mode. Fixes https://github.com/flutter/flutter/issues/86052
This commit is contained in:
@ -208,9 +208,14 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
return deviceIds;
|
||||
}
|
||||
|
||||
String output = result.stdout as String;
|
||||
// --machine doesn't currently prevent the tool from printing banners;
|
||||
// see https://github.com/flutter/flutter/issues/86055. This workaround
|
||||
// can be removed once that is fixed.
|
||||
output = output.substring(output.indexOf('['));
|
||||
|
||||
final List<Map<String, dynamic>> devices =
|
||||
(jsonDecode(result.stdout as String) as List<dynamic>)
|
||||
.cast<Map<String, dynamic>>();
|
||||
(jsonDecode(output) as List<dynamic>).cast<Map<String, dynamic>>();
|
||||
for (final Map<String, dynamic> deviceInfo in devices) {
|
||||
final String targetPlatform =
|
||||
(deviceInfo['targetPlatform'] as String?) ?? '';
|
||||
|
Reference in New Issue
Block a user