Skip to content

Conversation

@flutteractionsbot
Copy link

@flutteractionsbot flutteractionsbot commented Nov 12, 2025

This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.

Issue Link:

What is the link to the issue this cherry-pick is addressing?

#178052

Changelog Description:

Explain this cherry pick in one line that is accessible to most Flutter developers. See best practices for examples

The widget previewer fails to start if flutter pub get has not been run in the target project.

Impact Description:

What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)

The widget previewer will fail to launch. For CLI users, the error message stating that the command needs to be run within a Flutter project is misleading. For IDE users, they may get a dialog stating the widget previewer failed to start with no actionable feedback.

Workaround:

Is there a workaround for this issue?

Run flutter pub get in the project and then restart the widget previewer, either by relaunching the IDE or re-running flutter widget-preview start.

Risk:

What is the risk level of this cherry-pick?

  • Low
  • Medium
  • High

Test Coverage:

Are you confident that your fix is well-tested by automated tests?

  • Yes
  • No

Validation Steps:

What are the steps to validate that this fix works?

  1. Delete .dart_tool/ from a Flutter project.
  2. Run flutter widget-preview start within that project.
  3. The widget previewer should start successfully.

…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 flutteractionsbot added the cp: review Cherry-picks in the review queue label Nov 12, 2025
@flutteractionsbot
Copy link
Author

@bkonyi please fill out the PR description above, afterwards the release team will review this request.

@flutter-dashboard
Copy link

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 12, 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 correctly modifies the widget preview command to no longer require the .dart_tool directory to exist. The project validation now correctly checks for the presence of pubspec.yaml instead of .dart_tool, and the scaffold directory creation is now recursive to handle cases where .dart_tool is missing. A new regression test has been added to verify this fix. The changes are correct and well-tested.

@bkonyi bkonyi changed the title [CP-beta][ Widget Preview ] Don't require 'flutter pub get' to be run in the root project [CP-stable][ Widget Preview ] Don't require 'flutter pub get' to be run in the root project Nov 13, 2025
@reidbaker
Copy link
Contributor

I can land this change but @bkonyi I dont understand how the change description matches the code change.

@bkonyi
Copy link
Contributor

bkonyi commented Nov 17, 2025

I can land this change but @bkonyi I dont understand how the change description matches the code change.

Checking for an existing .dart_tool directory isn't a valid indicator of whether or not a directory contains a valid Flutter project. If flutter pub get hasn't been run, .dart_tool doesn't exist, and we're currently complaining that the current directory doesn't contain a valid project even if it does.

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2025
@auto-submit auto-submit bot merged commit 06f9b6a into flutter:flutter-3.38-candidate.0 Nov 17, 2025
146 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App cp: review Cherry-picks in the review queue tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants