File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 3232 */
3333public class PubRoot {
3434 public static final String DOT_DART_TOOL = ".dart_tool" ;
35+ public static final String PACKAGE_CONFIG_JSON = "package_config.json" ;
3536 public static final String DOT_PACKAGES = ".packages" ;
3637 public static final String PUBSPEC_YAML = "pubspec.yaml" ;
3738
@@ -288,14 +289,16 @@ public VirtualFile getPackageConfigFile() {
288289 // If this package.yaml file has resolution:workspace declared, check in the parent directory for
289290 // the .dart_tool/ directory.
290291 // https://github.com/flutter/flutter-intellij/issues/7623
291- if (cachedPubspecInfo . isResolutionWorkspace ()) {
292+ if (declaresResolutionWorkspace () && root . getParent () != null && root . getParent (). isDirectory ()) {
292293 rootToExpectToolsDirectory = root .getParent ();
293294 }
295+ assert rootToExpectToolsDirectory != null ;
296+ assert rootToExpectToolsDirectory .isDirectory ();
294297 final VirtualFile tools = rootToExpectToolsDirectory .findChild (DOT_DART_TOOL );
295298 if (tools == null || !tools .isDirectory ()) {
296299 return null ;
297300 }
298- final VirtualFile config = tools .findChild ("package_config.json" );
301+ final VirtualFile config = tools .findChild (PACKAGE_CONFIG_JSON );
299302 if (config != null && !config .isDirectory ()) {
300303 return config ;
301304 }
You can’t perform that action at this time.
0 commit comments