public static boolean isInDartSdkOrDartPackagesFolder(final @NotNull PsiFile psiFile) {
final VirtualFile vFile = psiFile.getOriginalFile().getVirtualFile();
return vFile != null && isInDartSdkOrDartPackagesFolder(psiFile.getProject(), vFile);
}
public static boolean isInDartSdkOrDartPackagesFolder(final @NotNull Project project, final @NotNull VirtualFile file) {
<BUG>final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (fileIndex.isInLibraryClasses(file)) {
return true; // file in SDK or in custom package root
}
if (fileIndex.isExcluded(file) || (fileIndex.isInContent(file) && isInDartPackagesFolder(fileIndex, file))) {
return true; // symlinked child of 'packages' folder. Real location is in user cache folder for Dart packages, not in project
}
return false;</BUG>
}

public static boolean isInDartSdkOrDartPackagesFolder(final @NotNull PsiFile psiFile) {
final VirtualFile vFile = psiFile.getOriginalFile().getVirtualFile();
return vFile != null && isInDartSdkOrDartPackagesFolder(psiFile.getProject(), vFile);
}
public static boolean isInDartSdkOrDartPackagesFolder(final @NotNull Project project, final @NotNull VirtualFile file) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
return !fileIndex.isInContent(file) || fileIndex.isExcluded(file) || isInDartPackagesFolder(fileIndex, file);
}
