switch statement cleanup (#148382)

This PR is step 12 in the journey to solve issue #136139 and make the
entire Flutter repo more readable.

Most of it involves implementing switch expressions, and there's also a
few other random things that I wanted to clean up a bit.
This commit is contained in:
Nate
2024-05-16 18:16:06 -06:00
committed by GitHub
parent c4ad1dc1e9
commit fa9992eff6
39 changed files with 301 additions and 529 deletions

View File

@@ -252,14 +252,11 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
}
Future<bool> _matchesCPURequirement(AndroidDevice device) async {
switch (cpu) {
case null:
return true;
case AndroidCPU.arm64:
return device.isArm64();
case AndroidCPU.arm:
return device.isArm();
}
return switch (cpu) {
null => Future<bool>.value(true),
AndroidCPU.arm64 => device.isArm64(),
AndroidCPU.arm => device.isArm(),
};
}
/// Picks a random Android device out of connected devices and sets it as