Skip to content
Merged
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
6 changes: 5 additions & 1 deletion src/io/flutter/pub/PubRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,13 @@ public VirtualFile getPackagesFile() {
}

/**
* Returns true if the packages file is up to date.
* Returns true if the packages are up to date wrt pubspec.yaml.
*/
public boolean hasUpToDatePackages() {
final VirtualFile configFile = getPackageConfigFile();
if (configFile != null) {
return pubspec.getTimeStamp() < configFile.getTimeStamp();
}
final VirtualFile packagesFile = getPackagesFile();
if (packagesFile == null) {
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/io/flutter/sdk/FlutterSdkUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ public static void enableDartSdk(@NotNull final Project project) {
public static String guessFlutterSdkFromPackagesFile(@NotNull Module module) {
// First, look for .dart_tool/package_config.json
for (PubRoot pubRoot : PubRoots.forModule(module)) {
final VirtualFile packagesFile = pubRoot.getPackageConfigFile();
if (packagesFile == null) {
final VirtualFile configFile = pubRoot.getPackageConfigFile();
if (configFile == null) {
continue;
}
// parse it
try {
final String contents = new String(packagesFile.contentsToByteArray(true /* cache contents */));
final String contents = new String(configFile.contentsToByteArray(true /* cache contents */));
final JsonElement element = new JsonParser().parse(contents);
if (element == null) {
continue;
Expand Down