Handle single unsupported device (#39541)
This commit is contained in:
parent
6266d5f35d
commit
b2a4ebe38f
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user