Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion flutter-idea/src/io/flutter/FlutterUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
Expand Down Expand Up @@ -117,7 +118,8 @@ public static boolean couldContainWidgets(@Nullable Project project, @Nullable V
!(file instanceof LightVirtualFile) &&
isDartFile(file) &&
file.isInLocalFileSystem() &&
ProjectFileIndex.getInstance(project).isInProject(file);
ApplicationManager.getApplication().runReadAction(
(Computable<Boolean>)()->ProjectFileIndex.getInstance(project).isInProject(file));
}

public static boolean isDartFile(@NotNull VirtualFile file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.intellij.openapi.roots.ModuleRootEvent;
import com.intellij.openapi.roots.ModuleRootListener;
import com.intellij.openapi.roots.libraries.PersistentLibraryKind;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vfs.*;
import com.jetbrains.lang.dart.util.DotPackagesFileUtil;
import io.flutter.pub.PubRoot;
Expand Down Expand Up @@ -137,7 +138,7 @@ private static Set<String> getFlutterPluginPaths(List<PubRoot> roots) {
if (libFolder == null) {
continue;
}
final PubRoot pluginRoot = PubRoot.forDirectory(libFolder.getParent());
final PubRoot pluginRoot = ApplicationManager.getApplication().runReadAction((Computable<PubRoot>)()->PubRoot.forDirectory(libFolder.getParent()));
if (pluginRoot == null) {
continue;
}
Expand Down