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 32
32
*/
33
33
public class PubRoot {
34
34
public static final String DOT_DART_TOOL = ".dart_tool" ;
35
+ public static final String PACKAGE_CONFIG_JSON = "package_config.json" ;
35
36
public static final String DOT_PACKAGES = ".packages" ;
36
37
public static final String PUBSPEC_YAML = "pubspec.yaml" ;
37
38
@@ -288,14 +289,16 @@ public VirtualFile getPackageConfigFile() {
288
289
// If this package.yaml file has resolution:workspace declared, check in the parent directory for
289
290
// the .dart_tool/ directory.
290
291
// https://github.com/flutter/flutter-intellij/issues/7623
291
- if (cachedPubspecInfo . isResolutionWorkspace ()) {
292
+ if (declaresResolutionWorkspace () && root . getParent () != null && root . getParent (). isDirectory ()) {
292
293
rootToExpectToolsDirectory = root .getParent ();
293
294
}
295
+ assert rootToExpectToolsDirectory != null ;
296
+ assert rootToExpectToolsDirectory .isDirectory ();
294
297
final VirtualFile tools = rootToExpectToolsDirectory .findChild (DOT_DART_TOOL );
295
298
if (tools == null || !tools .isDirectory ()) {
296
299
return null ;
297
300
}
298
- final VirtualFile config = tools .findChild ("package_config.json" );
301
+ final VirtualFile config = tools .findChild (PACKAGE_CONFIG_JSON );
299
302
if (config != null && !config .isDirectory ()) {
300
303
return config ;
301
304
}
You can’t perform that action at this time.
0 commit comments