From 373af204a620ffdbc151830b1443d85b96dc5dde Mon Sep 17 00:00:00 2001 From: Steve Messick Date: Tue, 12 Apr 2022 12:58:19 -0700 Subject: [PATCH 1/2] Select disktop or web if no other device is available --- flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java b/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java index 6527583e7c..d378f0461f 100644 --- a/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java +++ b/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java @@ -46,8 +46,11 @@ DeviceSelection withDevices(@NotNull List newDevices) { final Optional selectedDevice = findById(newDevices, selectedId); // If there's no selected device, default the first ephemoral one in the list. - final FlutterDevice firstEphemoral = + FlutterDevice firstEphemoral = newDevices.stream().filter(FlutterDevice::ephemeral).findFirst().orElse(null); + if (firstEphemoral == null && !newDevices.isEmpty()) { + firstEphemoral = newDevices.get(0); + } return new DeviceSelection(ImmutableList.copyOf(newDevices), selectedDevice.orElse(firstEphemoral)); } From adffc678d61a06251a7d031f613667ca8602560a Mon Sep 17 00:00:00 2001 From: Steve Messick Date: Tue, 12 Apr 2022 13:08:23 -0700 Subject: [PATCH 2/2] Typo --- .../src/io/flutter/run/daemon/DeviceSelection.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java b/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java index d378f0461f..21c16e7aac 100644 --- a/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java +++ b/flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java @@ -46,12 +46,12 @@ DeviceSelection withDevices(@NotNull List newDevices) { final Optional selectedDevice = findById(newDevices, selectedId); // If there's no selected device, default the first ephemoral one in the list. - FlutterDevice firstEphemoral = + FlutterDevice firstEphemeral = newDevices.stream().filter(FlutterDevice::ephemeral).findFirst().orElse(null); - if (firstEphemoral == null && !newDevices.isEmpty()) { - firstEphemoral = newDevices.get(0); + if (firstEphemeral == null && !newDevices.isEmpty()) { + firstEphemeral = newDevices.get(0); } - return new DeviceSelection(ImmutableList.copyOf(newDevices), selectedDevice.orElse(firstEphemoral)); + return new DeviceSelection(ImmutableList.copyOf(newDevices), selectedDevice.orElse(firstEphemeral)); } /**