[flutter_tools] Format empty app template with latest dart format#187443
Conversation
The main.dart produced by `flutter create --empty` still contained a `MaterialApp`/`Scaffold`/`Center` tree expanded across multiple lines. The current `dart format` collapses that onto a single line because it fits, so a freshly created empty project showed formatting drift. Update the template source so the generated project is already formatted. The other template Dart files exercised by the issue's repro (app, package, plugin, package_ffi, plugin_ffi, module) are already up to date with the current formatter. Fixes flutter#175960
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
This is a whitespace-only reformat of a generated-project template (no behavior change), so I believe it qualifies for a test exemption. The existing The issue (#175960) does mention a possible follow-up test that verifies templates stay formatted, but also notes it "might cause friction in Dart rolls that change |
|
autosubmit label was removed for flutter/flutter/187443, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
flutter/flutter@3a0420c...b10d0f1 2026-06-17 mr-peipei@web.de Skip platform-specific plugin registration if no platforms enabled (flutter/flutter#186304) 2026-06-17 engine-flutter-autoroll@skia.org Roll Packages from 8286d39 to 6ce00a8 (1 revision) (flutter/flutter#188109) 2026-06-17 engine-flutter-autoroll@skia.org Roll Skia from 79f93fd5f36e to 5d19002eb73e (1 revision) (flutter/flutter#188108) 2026-06-17 simon@journeyapps.com Import `dart:_js_interop_wasm` in addition to `dart:_wasm` to convert between `JSAny` and `WasmExternRef?` (flutter/flutter#186974) 2026-06-17 engine-flutter-autoroll@skia.org Roll Dart SDK from f811ecae9ca0 to e39bde5b1bfc (2 revisions) (flutter/flutter#188107) 2026-06-17 engine-flutter-autoroll@skia.org Roll Skia from 026f6a6be2b9 to 79f93fd5f36e (1 revision) (flutter/flutter#188105) 2026-06-17 engine-flutter-autoroll@skia.org Roll Dart SDK from 462bf0a1d489 to f811ecae9ca0 (1 revision) (flutter/flutter#188099) 2026-06-17 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from VeLhhlDcod09NR4Hb... to or21OEdGtairm6nl9... (flutter/flutter#188098) 2026-06-17 engine-flutter-autoroll@skia.org Roll Skia from 2ffd155313f5 to 026f6a6be2b9 (10 revisions) (flutter/flutter#188097) 2026-06-17 engine-flutter-autoroll@skia.org Roll Dart SDK from 824b4b48b6d4 to 462bf0a1d489 (1 revision) (flutter/flutter#188093) 2026-06-17 jason-simmons@users.noreply.github.com Manual Dart roll from f6c31f4c3a63 to 824b4b48b6d4 (flutter/flutter#188023) 2026-06-17 awolff@google.com Add a platform view test to android_hardware_smoke_test (flutter/flutter#188069) 2026-06-17 44747303+theprantadutta@users.noreply.github.com [flutter_tools] Format empty app template with latest dart format (flutter/flutter#187443) 2026-06-16 49699333+dependabot[bot]@users.noreply.github.com Bump the all-github-actions group across 1 directory with 3 updates (flutter/flutter#188086) 2026-06-16 engine-flutter-autoroll@skia.org Roll Skia from d7196b0b4939 to 2ffd155313f5 (9 revisions) (flutter/flutter#188081) 2026-06-16 43089218+chika3742@users.noreply.github.com Prevent downgrading `project.pbxproj` when greater version number (flutter/flutter#186250) 2026-06-16 magder@google.com Only allow dependabot to autoupdate GitHub-owned actions (flutter/flutter#187936) 2026-06-16 matt.boetger@gmail.com Fall back to source AndroidManifest.xml if AAPT fails or returns garbage (flutter/flutter#187197) 2026-06-16 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#187769) 2026-06-16 jason-simmons@users.noreply.github.com [Impeller] Move queue submission into a callback that is invoked by FenceWaiterVK::AddFence only if it can accept the fence (flutter/flutter#187761) 2026-06-16 jhy03261997@gmail.com Reland [a11y] Map some framework semantics roles to android classes. (flutter/flutter#188037) 2026-06-16 1961493+harryterkelsen@users.noreply.github.com refactor(web): Unify Image on Skwasm and CanvasKit (flutter/flutter#187873) 2026-06-16 30870216+gaaclarke@users.noreply.github.com Adds arm64 variant of impeller devicelab tests for windows. (flutter/flutter#188053) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…utter#187443) The `lib/main.dart` produced by `flutter create --empty` still had its `MaterialApp` / `Scaffold` / `Center` widget tree expanded across multiple lines: ```dart return const MaterialApp( home: Scaffold( body: Center( child: Text('Hello World!'), ), ), ); ``` The current `dart format` collapses that onto a single line because it fits within the line length: ```dart return const MaterialApp( home: Scaffold(body: Center(child: Text('Hello World!'))), ); ``` So a freshly created empty project showed formatting drift. This updates the template source (`templates/app/lib/main.dart.tmpl`, `withEmptyMain` block) so the generated project is already formatted. I checked the other template Dart files exercised by the issue's repro commands (`app`, `package`, `plugin --platforms=...`, `package_ffi`, `plugin_ffi`, `module`) and they are already up to date with the current formatter — earlier changes appear to have brought the rest in line, leaving the `--empty` variant as the remaining drift. The issue's second (optional) work item — adding a test that verifies templates stay formatted — is left out here, since the issue notes it "might cause friction in Dart rolls that change `dart format`'s style" and "might not be desirable." Happy to follow up on that separately if the team wants it. *List which issues are fixed by this PR.* Partially fixes flutter#175960 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. This is a whitespace-only change to a generated-project template, so it is test-exempt; the existing `flutter create --empty` test in `create_test.dart` (which asserts the generated `main.dart` contains `Text('Hello World!')`) continues to pass, as the change preserves that string. ### How I verified - Confirmed `dart format` produces the collapsed single-line form for the generated `--empty` output (the affected template block contains no template variables, so the generated file matches the formatted Dart exactly). - Manually checked the remaining template Dart files for the project types in the issue's repro; all are already formatter-clean on current `master`. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Co-authored-by: Ben Konyi <bkonyi@google.com>
…utter#187443) The `lib/main.dart` produced by `flutter create --empty` still had its `MaterialApp` / `Scaffold` / `Center` widget tree expanded across multiple lines: ```dart return const MaterialApp( home: Scaffold( body: Center( child: Text('Hello World!'), ), ), ); ``` The current `dart format` collapses that onto a single line because it fits within the line length: ```dart return const MaterialApp( home: Scaffold(body: Center(child: Text('Hello World!'))), ); ``` So a freshly created empty project showed formatting drift. This updates the template source (`templates/app/lib/main.dart.tmpl`, `withEmptyMain` block) so the generated project is already formatted. I checked the other template Dart files exercised by the issue's repro commands (`app`, `package`, `plugin --platforms=...`, `package_ffi`, `plugin_ffi`, `module`) and they are already up to date with the current formatter — earlier changes appear to have brought the rest in line, leaving the `--empty` variant as the remaining drift. The issue's second (optional) work item — adding a test that verifies templates stay formatted — is left out here, since the issue notes it "might cause friction in Dart rolls that change `dart format`'s style" and "might not be desirable." Happy to follow up on that separately if the team wants it. *List which issues are fixed by this PR.* Partially fixes flutter#175960 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. This is a whitespace-only change to a generated-project template, so it is test-exempt; the existing `flutter create --empty` test in `create_test.dart` (which asserts the generated `main.dart` contains `Text('Hello World!')`) continues to pass, as the change preserves that string. ### How I verified - Confirmed `dart format` produces the collapsed single-line form for the generated `--empty` output (the affected template block contains no template variables, so the generated file matches the formatted Dart exactly). - Manually checked the remaining template Dart files for the project types in the issue's repro; all are already formatter-clean on current `master`. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Co-authored-by: Ben Konyi <bkonyi@google.com>
The
lib/main.dartproduced byflutter create --emptystill had itsMaterialApp/Scaffold/Centerwidget tree expanded across multiple lines:The current
dart formatcollapses that onto a single line because it fits within the line length:So a freshly created empty project showed formatting drift. This updates the template source (
templates/app/lib/main.dart.tmpl,withEmptyMainblock) so the generated project is already formatted.I checked the other template Dart files exercised by the issue's repro commands (
app,package,plugin --platforms=...,package_ffi,plugin_ffi,module) and they are already up to date with the current formatter — earlier changes appear to have brought the rest in line, leaving the--emptyvariant as the remaining drift.The issue's second (optional) work item — adding a test that verifies templates stay formatted — is left out here, since the issue notes it "might cause friction in Dart rolls that change
dart format's style" and "might not be desirable." Happy to follow up on that separately if the team wants it.List which issues are fixed by this PR.
Partially fixes #175960
Pre-launch Checklist
///).This is a whitespace-only change to a generated-project template, so it is test-exempt; the existing
flutter create --emptytest increate_test.dart(which asserts the generatedmain.dartcontainsText('Hello World!')) continues to pass, as the change preserves that string.How I verified
dart formatproduces the collapsed single-line form for the generated--emptyoutput (the affected template block contains no template variables, so the generated file matches the formatted Dart exactly).master.