Skip to content

Conversation

@bkonyi
Copy link
Contributor

@bkonyi bkonyi commented Nov 17, 2025

If the .dart_tool/widget_preview_scaffold/.dart_tool/ directory wasn't created during the initial run of flutter widget-preview start due to the command being interrupted or pub being disabled, flutter widget-preview start would crash due to the package_config.json logic walking up the directory structure looking for the nearest package_config.json. This would point to the parent project's package_config.json, which would not be compatible with the widget preview scaffold project.

Fixes #178660 and #177655

…` doesn't exist

If the `.dart_tool/widget_preview_scaffold/.dart_tool/` directory wasn't
created during the initial run of `flutter widget-preview start` due to
the command being interrupted or `pub` being disabled, `flutter
widget-preview start` would crash due to the `package_config.json` logic
walking up the directory structure looking for the nearest
`package_config.json`. This would point to the parent project's
`package_config.json`, which would not be compatible with the widget
preview scaffold project.

Fixes #178660
@bkonyi bkonyi requested a review from jyameo November 17, 2025 18:08
@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 17, 2025
@bkonyi bkonyi linked an issue Nov 17, 2025 that may be closed by this pull request
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 fixes a crash in flutter widget-preview start when the scaffold's .dart_tool directory is missing. The changes ensure that pub get is run for the scaffold project if needed. The logic is sound and a good regression test is added. I've suggested a small refactoring to reduce code duplication in preview_pubspec_builder.dart.

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 17, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Nov 17, 2025

autosubmit label was removed for flutter/flutter/178662, because - The status or check suite Windows tool_tests_commands has failed. Please fix the issues identified (or deflake) before re-applying this label.

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Nov 17, 2025
Merged via the queue into master with commit cc14ef5 Nov 17, 2025
148 checks passed
@auto-submit auto-submit bot deleted the fix_issue_178660 branch November 17, 2025 22:10
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 18, 2025
…#10455)

Manual roll Flutter from 9b5ad8031646 to cc14ef529014 (143 revisions)

Manual roll requested by [email protected]

flutter/flutter@9b5ad80...cc14ef5

2025-11-17 [email protected] [ Widget Preview ] Fix crash when `widget_preview_scaffold/.dart_tool` doesn't exist (flutter/flutter#178662)
2025-11-17 [email protected] Dev proxy correctly copy query parameters from original request (flutter/flutter#178162)
2025-11-17 [email protected] Roll Dart SDK from ac5942fe75d0 to cf94632d94a1 (1 revision) (flutter/flutter#178664)
2025-11-17 [email protected] Improve code quality `FlutterViewTest.java`  (flutter/flutter#178594)
2025-11-17 [email protected] Roll customer tests (flutter/flutter#178652)
2025-11-17 [email protected] Corrects invalid Flutter wiki links (flutter/flutter#178158)
2025-11-17 [email protected] Fix LateInitializationError in didChangeTextScaleFactor code example. (flutter/flutter#178375)
2025-11-17 [email protected] Roll Skia from d877de9fc23e to 84c83c0dfb4a (3 revisions) (flutter/flutter#178653)
2025-11-17 [email protected] Small refactor in `DartMessenger.java` to use method reference (flutter/flutter#178584)
2025-11-17 [email protected] fix typos in `PlatformChannel.java‎` docs (flutter/flutter#178589)
2025-11-17 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Enable UIScene Migration and update create templates (#178328)" (flutter/flutter#178665)
2025-11-17 [email protected] Remove unnecessary `String.valueOf` in `‎ListenableEditingState.java‎` (flutter/flutter#178597)
2025-11-17 [email protected] Update `Metadata.java‎` to use `getBytes` in a static context (flutter/flutter#178587)
2025-11-17 [email protected] Reduce the data copying in CanvasPath related to the SkPathBuilder API migration (flutter/flutter#178512)
2025-11-17 [email protected] Roll Packages from 799b62c to ce44ebb (10 revisions) (flutter/flutter#178649)
2025-11-17 [email protected] Enable UIScene Migration and update create templates (flutter/flutter#178328)
2025-11-17 [email protected] Roll Skia from 5fb44352b232 to d877de9fc23e (1 revision) (flutter/flutter#178647)
2025-11-17 [email protected] Revert "Separate copying dsym into its own target (#178261)" (flutter/flutter#178545)
2025-11-17 [email protected] [web] Reduce Skwasm test shards to 2 (flutter/flutter#178239)
2025-11-17 [email protected] Roll Dart SDK from ee793f732959 to ac5942fe75d0 (1 revision) (flutter/flutter#178637)
2025-11-17 [email protected] Roll Skia from b30859d35b89 to 5fb44352b232 (1 revision) (flutter/flutter#178636)
2025-11-17 [email protected] Roll Skia from 5b7f8f61528e to b30859d35b89 (1 revision) (flutter/flutter#178634)
2025-11-17 [email protected] Roll Skia from aad0515710a9 to 5b7f8f61528e (7 revisions) (flutter/flutter#178631)
2025-11-17 [email protected] Roll Skia from 761e1fe67e15 to aad0515710a9 (1 revision) (flutter/flutter#178624)
2025-11-16 [email protected] Roll Skia from 5f9157717150 to 761e1fe67e15 (1 revision) (flutter/flutter#178614)
2025-11-16 [email protected] Roll Skia from 1b435b65e754 to 5f9157717150 (1 revision) (flutter/flutter#178612)
2025-11-16 [email protected] Roll Dart SDK from dffc5f3f9be6 to ee793f732959 (1 revision) (flutter/flutter#178607)
2025-11-16 [email protected] Roll Skia from ce2168cf2b6c to 1b435b65e754 (1 revision) (flutter/flutter#178604)
2025-11-15 [email protected] Roll Dart SDK from 50eca21d80c4 to dffc5f3f9be6 (1 revision) (flutter/flutter#178603)
2025-11-15 [email protected] [macOS] Implement dialog window (flutter/flutter#176893)
2025-11-15 [email protected] Roll Dart SDK from f6f88ed5e5a1 to 50eca21d80c4 (1 revision) (flutter/flutter#178599)
2025-11-15 [email protected] Roll Dart SDK from 9eda5b525ca9 to f6f88ed5e5a1 (1 revision) (flutter/flutter#178576)
2025-11-15 [email protected] Roll Skia from c5c3399b3a84 to ce2168cf2b6c (1 revision) (flutter/flutter#178577)
2025-11-15 [email protected] Add a `RepeatingAnimationBuilder` API (flutter/flutter#174014)
2025-11-15 [email protected] Roll Dart SDK from 486be9c17488 to 9eda5b525ca9 (1 revision) (flutter/flutter#178562)
2025-11-15 [email protected] Roll Skia from f5d29842bf45 to c5c3399b3a84 (1 revision) (flutter/flutter#178559)
2025-11-14 [email protected] Roll Skia from f58b1b8052a2 to f5d29842bf45 (3 revisions) (flutter/flutter#178556)
2025-11-14 [email protected] Roll Dart SDK from c6c5f6c169a9 to 486be9c17488 (1 revision) (flutter/flutter#178555)
2025-11-14 [email protected] [ Widget Preview ] Gracefully handle unexpected analysis context disposal (flutter/flutter#178550)
2025-11-14 [email protected] docs: Add documentation for running devicelab tests in a PR (flutter/flutter#178554)
2025-11-14 [email protected] [Reland] Generate new Gradle lockfiles and delete ignore files (flutter/flutter#178553)
2025-11-14 [email protected] Fix crash when doing a SaveLayer under a non-invertible transform (flutter/flutter#178507)
2025-11-14 [email protected] [Reland] Generate ignore lockfiles and Update Android Embedder Dependencies (flutter/flutter#178538)
2025-11-14 [email protected] Roll Skia from 4c02d9fc79c1 to f58b1b8052a2 (1 revision) (flutter/flutter#178543)
...
IvoneDjaja pushed a commit to IvoneDjaja/flutter that referenced this pull request Nov 22, 2025
…` doesn't exist (flutter#178662)

If the `.dart_tool/widget_preview_scaffold/.dart_tool/` directory wasn't
created during the initial run of `flutter widget-preview start` due to
the command being interrupted or `pub` being disabled, `flutter
widget-preview start` would crash due to the `package_config.json` logic
walking up the directory structure looking for the nearest
`package_config.json`. This would point to the parent project's
`package_config.json`, which would not be compatible with the widget
preview scaffold project.

Fixes flutter#178660 and
flutter#177655
@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 24, 2025
flutteractionsbot pushed a commit to flutteractionsbot/flutter that referenced this pull request Nov 24, 2025
…` doesn't exist (flutter#178662)

If the `.dart_tool/widget_preview_scaffold/.dart_tool/` directory wasn't
created during the initial run of `flutter widget-preview start` due to
the command being interrupted or `pub` being disabled, `flutter
widget-preview start` would crash due to the `package_config.json` logic
walking up the directory structure looking for the nearest
`package_config.json`. This would point to the parent project's
`package_config.json`, which would not be compatible with the widget
preview scaffold project.

Fixes flutter#178660 and
flutter#177655
flutteractionsbot pushed a commit to flutteractionsbot/flutter that referenced this pull request Nov 24, 2025
…` doesn't exist (flutter#178662)

If the `.dart_tool/widget_preview_scaffold/.dart_tool/` directory wasn't
created during the initial run of `flutter widget-preview start` due to
the command being interrupted or `pub` being disabled, `flutter
widget-preview start` would crash due to the `package_config.json` logic
walking up the directory structure looking for the nearest
`package_config.json`. This would point to the parent project's
`package_config.json`, which would not be compatible with the widget
preview scaffold project.

Fixes flutter#178660 and
flutter#177655
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
…` doesn't exist (flutter#178662)

If the `.dart_tool/widget_preview_scaffold/.dart_tool/` directory wasn't
created during the initial run of `flutter widget-preview start` due to
the command being interrupted or `pub` being disabled, `flutter
widget-preview start` would crash due to the `package_config.json` logic
walking up the directory structure looking for the nearest
`package_config.json`. This would point to the parent project's
`package_config.json`, which would not be compatible with the widget
preview scaffold project.

Fixes flutter#178660 and
flutter#177655
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…` doesn't exist (flutter#178662)

If the `.dart_tool/widget_preview_scaffold/.dart_tool/` directory wasn't
created during the initial run of `flutter widget-preview start` due to
the command being interrupted or `pub` being disabled, `flutter
widget-preview start` would crash due to the `package_config.json` logic
walking up the directory structure looking for the nearest
`package_config.json`. This would point to the parent project's
`package_config.json`, which would not be compatible with the widget
preview scaffold project.

Fixes flutter#178660 and
flutter#177655
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

2 participants