Skip to content

Commit 05da77e

Browse files
Fix: Flutter SDK path in settings is not updated (#8827)
The settings page UI for the Flutter SDK path was not updating after being changed. When a user updated the path, applied the change, and re-opened settings, the old path would still be displayed. This was caused by the settings page reading the SDK path from a stale cache provided by the Dart plugin (FlutterSdk.getFlutterSdk()). The fix is to use FlutterSdk.getIncomplete() instead, which bypasses the cache and reads the path directly from the authoritative source: the project's Library Table configuration. This ensures the UI always displays the currently configured value. Fixes: #8641 Thanks for your contribution! Please replace this text with a description of what this PR is changing or adding and why, list any relevant issues, and review the contribution guidelines below. --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent b522f9a commit 05da77e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/io/flutter/sdk/FlutterSettingsConfigurable.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright 2016 The Chromium Authors. All rights reserved.
33
* Use of this source code is governed by a BSD-style license that can be
44
* found in the LICENSE file.
@@ -15,6 +15,7 @@
1515
import com.intellij.openapi.actionSystem.ActionToolbar;
1616
import com.intellij.openapi.application.ApplicationManager;
1717
import com.intellij.openapi.application.ModalityState;
18+
import com.intellij.openapi.application.ReadAction;
1819
import com.intellij.openapi.fileChooser.FileChooser;
1920
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
2021
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
@@ -110,7 +111,7 @@ public class FlutterSettingsConfigurable implements SearchableConfigurable {
110111
}
111112

112113
private void init() {
113-
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(myProject);
114+
final FlutterSdk sdk = ReadAction.compute(() -> FlutterSdk.getIncomplete(myProject));
114115
if (sdk != null) {
115116
previousSdkVersion = sdk.getVersion();
116117
}
@@ -185,7 +186,7 @@ public JComponent createComponent() {
185186
@Override
186187
public boolean isModified() {
187188

188-
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(myProject);
189+
final FlutterSdk sdk = FlutterSdk.getIncomplete(myProject);
189190
final FlutterSettings settings = FlutterSettings.getInstance();
190191
final String sdkPathInModel = sdk == null ? "" : sdk.getHomePath();
191192
final String sdkPathInUI = FileUtilRt.toSystemIndependentName(getSdkPathText());
@@ -312,7 +313,7 @@ public void apply() throws ConfigurationException {
312313

313314
@Override
314315
public void reset() {
315-
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(myProject);
316+
final FlutterSdk sdk = ReadAction.compute(() -> FlutterSdk.getIncomplete(myProject));
316317
final String path = sdk != null ? sdk.getHomePath() : "";
317318

318319
// Set this after populating the combo box to display correctly when the Flutter SDK is unset.

0 commit comments

Comments
 (0)