Only access globals.deviceManager if actually setting something (#111461)

This commit is contained in:
jensjoha
2022-09-19 09:18:31 +02:00
committed by GitHub
parent b84bfa3526
commit 836c16efc0

View File

@@ -256,7 +256,10 @@ class FlutterCommandRunner extends CommandRunner<void> {
}
// See if the user specified a specific device.
globals.deviceManager?.specifiedDeviceId = topLevelResults['device-id'] as String?;
final String? specifiedDeviceId = topLevelResults['device-id'] as String?;
if (specifiedDeviceId != null) {
globals.deviceManager?.specifiedDeviceId = specifiedDeviceId;
}
if ((topLevelResults['version'] as bool?) ?? false) {
globals.flutterUsage.sendCommand('version');