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