@@ -317,7 +317,9 @@ class HotRunner extends ResidentRunner {
317
317
// for all devices should be in sync.
318
318
final List <Uri > invalidatedFiles = ProjectFileInvalidator .findInvalidated (
319
319
lastCompiled: flutterDevices[0 ].devFS.lastCompiled,
320
- urisToMonitor: flutterDevices[0 ].devFS.sources);
320
+ urisToMonitor: flutterDevices[0 ].devFS.sources,
321
+ packagesPath: packagesFilePath,
322
+ );
321
323
final UpdateFSReport results = UpdateFSReport (success: true );
322
324
for (FlutterDevice device in flutterDevices) {
323
325
results.incorporateResults (await device.updateDevFS (
@@ -939,8 +941,11 @@ class ProjectFileInvalidator {
939
941
static const String _pubCachePathLinuxAndMac = '.pub-cache' ;
940
942
static const String _pubCachePathWindows = 'Pub/Cache' ;
941
943
942
- static List <Uri > findInvalidated ({@required DateTime lastCompiled,
943
- @required List <Uri > urisToMonitor}) {
944
+ static List <Uri > findInvalidated ({
945
+ @required DateTime lastCompiled,
946
+ @required List <Uri > urisToMonitor,
947
+ @required String packagesPath,
948
+ }) {
944
949
final List <Uri > invalidatedFiles = < Uri > [];
945
950
int scanned = 0 ;
946
951
final Stopwatch stopwatch = Stopwatch ()..start ();
@@ -960,6 +965,13 @@ class ProjectFileInvalidator {
960
965
invalidatedFiles.add (uri);
961
966
}
962
967
}
968
+ // we need to check the .packages file too since it is not used in compilation.
969
+ final DateTime packagesUpdatedAt = fs.statSync (packagesPath).modified;
970
+ if (lastCompiled != null && packagesUpdatedAt != null
971
+ && packagesUpdatedAt.millisecondsSinceEpoch > lastCompiled.millisecondsSinceEpoch) {
972
+ invalidatedFiles.add (fs.file (packagesPath).uri);
973
+ scanned++ ;
974
+ }
963
975
printTrace ('Scanned through $scanned files in ${stopwatch .elapsedMilliseconds }ms' );
964
976
return invalidatedFiles;
965
977
}
0 commit comments