Reland "if chains → switch expressions" (#148634)
I did a goof a while back:

Now that [the bug is fixed](e9d403541f), I think we're good to re-implement the if-chains cleanup!
Related:
- https://github.com/flutter/flutter/pull/147793
- https://github.com/flutter/flutter/pull/148556
- https://github.com/flutter/flutter/issues/148548
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user