if chains → switch expressions (#147793)

Previous "if-chains" pull requests:
- https://github.com/flutter/flutter/pull/144905
- https://github.com/flutter/flutter/pull/144977
- https://github.com/flutter/flutter/pull/145194
- https://github.com/flutter/flutter/pull/146293
- https://github.com/flutter/flutter/pull/147472

<br>

I think this one should be enough to wrap things up!

fixes https://github.com/flutter/flutter/issues/144903

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
This commit is contained in:
Nate
2024-05-10 00:55:48 -06:00
committed by GitHub
parent c90e18c6f5
commit 4734d80f22
33 changed files with 194 additions and 297 deletions

View File

@@ -290,13 +290,11 @@ class FakeDeviceManager implements DeviceManager {
Device? getSingleEphemeralDevice(List<Device> devices) => null;
List<Device> filteredDevices(DeviceDiscoveryFilter? filter) {
if (filter?.deviceConnectionInterface == DeviceConnectionInterface.attached) {
return attachedDevices;
}
if (filter?.deviceConnectionInterface == DeviceConnectionInterface.wireless) {
return wirelessDevices;
}
return attachedDevices + wirelessDevices;
return switch (filter?.deviceConnectionInterface) {
DeviceConnectionInterface.attached => attachedDevices,
DeviceConnectionInterface.wireless => wirelessDevices,
null => attachedDevices + wirelessDevices,
};
}
}