[ Widget Preview ] Ignore modifications to files in ephemeral directories#178398
Merged
auto-submit[bot] merged 3 commits intomasterfrom Nov 13, 2025
Merged
[ Widget Preview ] Ignore modifications to files in ephemeral directories#178398auto-submit[bot] merged 3 commits intomasterfrom
auto-submit[bot] merged 3 commits intomasterfrom
Conversation
…ries 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 #178317
Contributor
There was a problem hiding this comment.
Code Review
This pull request effectively addresses an issue where the widget previewer would crash when files in ephemeral directories were modified. The changes introduce logic to ignore file system events from these directories and from files not associated with an analysis context. This is a solid fix, complete with a new regression test. I have one minor suggestion to improve code clarity by removing a duplicated line.
flutteractionsbot
pushed a commit
to flutteractionsbot/flutter
that referenced
this pull request
Nov 13, 2025
…ries (flutter#178398) 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 flutter#178317
flutteractionsbot
pushed a commit
to flutteractionsbot/flutter
that referenced
this pull request
Nov 13, 2025
…ries (flutter#178398) 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 flutter#178317
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 16, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 16, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 16, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 17, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 17, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 17, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 17, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 17, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 17, 2025
IvoneDjaja
pushed a commit
to IvoneDjaja/flutter
that referenced
this pull request
Nov 22, 2025
…ries (flutter#178398) 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 flutter#178317
mboetger
pushed a commit
to mboetger/flutter
that referenced
this pull request
Dec 2, 2025
…ries (flutter#178398) 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 flutter#178317
reidbaker
pushed a commit
to AbdeMohlbi/flutter
that referenced
this pull request
Dec 10, 2025
…ries (flutter#178398) 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 flutter#178317
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
fluttertool 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 aflutter pub getdownloading 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
PreviewDetectorthat allow for ignoring changes topubspec.yamls and.dartsources under known ephemeral directories (e.g., build/,linux/flutter/ephemeral/, etc), as well as
.dartfiles that aren't associated with an analysis context.Fixes #178317