Skip to content

Conversation

@bkonyi
Copy link
Contributor

@bkonyi bkonyi commented Nov 7, 2025

Using the presence of .dart_tool in a project to determine if it's a valid Flutter project is not correct as the directory will not exist if flutter pub get has not yet been run.

Fixes #178052

…oot project

Using the presence of `.dart_tool` in a project to determine if it's a
valid Flutter project is not correct as the directory will not exist if
`flutter pub get` has not yet been run.

Fixes #178052
@bkonyi bkonyi requested a review from jyameo November 7, 2025 19:38
@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 7, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue where the widget preview command would fail if flutter pub get had not been run in the project. The fix correctly removes the check for the existence of the .dart_tool directory, which is not a reliable indicator of a valid Flutter project before dependencies are fetched. Additionally, the code is updated to recursively create the widget preview scaffold directory, ensuring the necessary directory structure is in place even if .dart_tool does not exist. A new regression test is included to verify that the command now succeeds in this scenario. The changes are correct and effectively resolve the issue.

Copy link
Contributor

@jyameo jyameo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Nov 10, 2025
Merged via the queue into master with commit 96624b6 Nov 11, 2025
151 checks passed
@auto-submit auto-submit bot deleted the fix_issue_178052 branch November 11, 2025 02:16
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
@bkonyi bkonyi added cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch labels Nov 12, 2025
flutteractionsbot pushed a commit to flutteractionsbot/flutter that referenced this pull request Nov 12, 2025
…oot project (flutter#178175)

Using the presence of `.dart_tool` in a project to determine if it's a
valid Flutter project is not correct as the directory will not exist if
`flutter pub get` has not yet been run.

Fixes flutter#178052
flutteractionsbot pushed a commit to flutteractionsbot/flutter that referenced this pull request Nov 12, 2025
…oot project (flutter#178175)

Using the presence of `.dart_tool` in a project to determine if it's a
valid Flutter project is not correct as the directory will not exist if
`flutter pub get` has not yet been run.

Fixes flutter#178052
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
@bkonyi bkonyi added cp: beta cherry pick this pull request to beta release candidate branch and removed cp: beta cherry pick this pull request to beta release candidate branch labels Nov 13, 2025
bkonyi added a commit that referenced this pull request Nov 13, 2025
…oot project (#178175)

Using the presence of `.dart_tool` in a project to determine if it's a
valid Flutter project is not correct as the directory will not exist if
`flutter pub get` has not yet been run.

Fixes #178052
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 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 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
…oot project (flutter#178175)

Using the presence of `.dart_tool` in a project to determine if it's a
valid Flutter project is not correct as the directory will not exist if
`flutter pub get` has not yet been run.

Fixes flutter#178052
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
…oot project (flutter#178175)

Using the presence of `.dart_tool` in a project to determine if it's a
valid Flutter project is not correct as the directory will not exist if
`flutter pub get` has not yet been run.

Fixes flutter#178052
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…oot project (flutter#178175)

Using the presence of `.dart_tool` in a project to determine if it's a
valid Flutter project is not correct as the directory will not exist if
`flutter pub get` has not yet been run.

Fixes flutter#178052
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cp: beta cherry pick this pull request to beta release candidate branch cp: stable cherry pick this pull request to stable release candidate branch tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widget Preview terminates with "is not a valid Flutter project" for valid Flutter project

2 participants