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:
@@ -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