mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The `flutter` tool creates various directories for ephemeral state while executing commands. In some situations, these directories contain or link to other Dart / Flutter projects with '.dart' sources or 'pubspec.yaml's. If these files change while the widget previewer is active (e.g., due to a `flutter pub get` downloading and configuring new plugins for the project), the previewer's directory watcher will detect the change and attempt to analyze the source. This causes an exception to be thrown by the analyzer as the modified file path does not have a valid analysis context. This change adds additional checks to the `PreviewDetector` that allow for ignoring changes to `pubspec.yaml`s and `.dart` sources under known ephemeral directories (e.g., build/, linux/flutter/ephemeral/, etc), as well as `.dart` files that aren't associated with an analysis context. Fixes https://github.com/flutter/flutter/issues/178317