Handle single unsupported device (#39541)

This commit is contained in:
Jonah Williams 2019-08-29 21:39:38 -07:00 committed by GitHub
parent 6266d5f35d
commit b2a4ebe38f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -190,6 +190,12 @@ class DeviceManager {
if (isDeviceSupportedForProject(device, flutterProject))
device
];
} else if (devices.length == 1 &&
!hasSpecifiedDeviceId &&
!isDeviceSupportedForProject(devices.single, flutterProject)) {
// If there is only a single device but it is not supported, then return
// early.
return <Device>[];
}
// If there are still multiple devices and the user did not specify to run

View File

@ -87,6 +87,17 @@ void main() {
]);
});
testUsingContext('Removes a single unsupported device', () async {
final List<Device> devices = <Device>[
unsupported,
];
final DeviceManager deviceManager = TestDeviceManager(devices);
final List<Device> filtered = await deviceManager.findTargetDevices(FlutterProject.current());
expect(filtered, <Device>[]);
});
testUsingContext('Removes web and fuchsia from --all', () async {
final List<Device> devices = <Device>[
webDevice,