in lib/src/directory_watcher/windows.dart [330:369]
List<FileSystemEvent> _eventsBasedOnFileSystem(String path) {
var fileExisted = _files.contains(path);
var dirExisted = _files.containsDir(path);
bool fileExists;
bool dirExists;
try {
fileExists = File(path).existsSync();
dirExists = Directory(path).existsSync();
} on FileSystemException {
return const <FileSystemEvent>[];
}
var events = <FileSystemEvent>[];
if (fileExisted) {
if (fileExists) {
events.add(ConstructableFileSystemModifyEvent(path, false, false));
} else {
events.add(ConstructableFileSystemDeleteEvent(path, false));
}
} else if (dirExisted) {
if (dirExists) {
// If we got contradictory events for a directory that used to exist and
// still exists, we need to rescan the whole thing in case it was
// replaced with a different directory.
events.add(ConstructableFileSystemDeleteEvent(path, true));
events.add(ConstructableFileSystemCreateEvent(path, true));
} else {
events.add(ConstructableFileSystemDeleteEvent(path, true));
}
}
if (!fileExisted && fileExists) {
events.add(ConstructableFileSystemCreateEvent(path, false));
} else if (!dirExisted && dirExists) {
events.add(ConstructableFileSystemCreateEvent(path, true));
}
return events;
}