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:
@@ -772,15 +772,14 @@ abstract class FlutterCommand extends Command<void> {
|
||||
return null;
|
||||
}();
|
||||
|
||||
DeviceConnectionInterface? get deviceConnectionInterface {
|
||||
DeviceConnectionInterface? get deviceConnectionInterface {
|
||||
if ((argResults?.options.contains(FlutterOptions.kDeviceConnection) ?? false)
|
||||
&& (argResults?.wasParsed(FlutterOptions.kDeviceConnection) ?? false)) {
|
||||
final String? connectionType = stringArg(FlutterOptions.kDeviceConnection);
|
||||
if (connectionType == 'attached') {
|
||||
return DeviceConnectionInterface.attached;
|
||||
} else if (connectionType == 'wireless') {
|
||||
return DeviceConnectionInterface.wireless;
|
||||
}
|
||||
return switch (stringArg(FlutterOptions.kDeviceConnection)) {
|
||||
'attached' => DeviceConnectionInterface.attached,
|
||||
'wireless' => DeviceConnectionInterface.wireless,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user