[flutter_tools] Format plugin example template to match dart format#188382
Conversation
The plugin example app's main.dart, generated from the plugin-hook block in app/lib/main.dart.tmpl, had a line exceeding 80 columns. As a result `flutter create -t plugin` produced an example/lib/main.dart that failed `dart format`. Wrap the line after `??` to match dart format's output. Part of flutter#175960. Follows up on flutter#187443, which formatted the --empty app template's main.dart in the same file.
|
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. |
Generates a plugin with `flutter create -t plugin` and asserts every generated .dart file is already formatted, mirroring the existing app and module template formatting tests. Guards against the example app formatting drift fixed in this PR. Part of flutter#175960.
|
Added a regression test in |
|
autosubmit label was removed for flutter/flutter/188382, because - The status or check suite Mac_arm64 tool_tests_commands has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
|
Thanks for the approvals @bkonyi @chingjun! Looks like |
|
@theprantadutta it looks like this is a legitimate test failure in |
|
You're right @bkonyi, thanks for catching that — and apologies for calling it a flake earlier. The new regression test caught a real leftover: the plugin's own generated test file. final {{pluginDartClass}}Platform initialPlatform = {{pluginDartClass}}Platform.instance;which lands at 81 columns with the test's Fixed in 4291067 by dropping the redundant type annotation ( One heads-up while verifying: with very short names (e.g. |
|
@theprantadutta there still appears to be formatting issues that are causing test failures. |
|
Thanks for the ping @bkonyi — root-caused it from the LUCI log. The master merge rolled in a newer formatter that now separates |
flutter/flutter@846664b...fc1ad95 2026-07-15 [email protected] [iOS] Migrate FlutterKeyboardInsetManager to Swift (flutter/flutter#189425) 2026-07-15 [email protected] Roll Dart SDK from 05bf153370c4 to 0c408ff6dce9 (4 revisions) (flutter/flutter#189487) 2026-07-15 [email protected] Implement UberSDF lines to replace LineContents-based AA lines (flutter/flutter#188514) 2026-07-15 [email protected] Fix stale eagerWinner reference in GestureArenaManager when rejected before arena close (flutter/flutter#187008) 2026-07-15 [email protected] Disable some Windows tests that are flaking on CI (flutter/flutter#189477) 2026-07-15 dmgr Added unified check-run user manual (flutter/flutter#189453) 2026-07-15 [email protected] Roll Skia from 88954ef8f36d to ab2410bc857c (9 revisions) (flutter/flutter#189474) 2026-07-14 [email protected] [agents] Refactor shepherd-prs skill into a pure Markdown runbook using native gh CLI (flutter/flutter#189095) 2026-07-14 [email protected] Add missing name to mirroring workflow (flutter/flutter#189439) 2026-07-14 [email protected] Add support for WASM deferred loading. (flutter/flutter#189308) 2026-07-14 [email protected] fix `templateDefaultGradleVersion` todo (flutter/flutter#189466) 2026-07-14 [email protected] Roll Fuchsia Linux SDK from oOETA0ISPouDt2xBo... to lLFbh5kFWbUGgC9Ek... (flutter/flutter#189469) 2026-07-14 [email protected] Use ServicesBinding.instance.exitApplication instead of exit(0) in multiple_windows example (flutter/flutter#189364) 2026-07-14 [email protected] Add CpuArch to the Device class (flutter/flutter#189207) 2026-07-14 [email protected] Fix space formatting in cherry-pick label for flutter_cp.dart (flutter/flutter#189463) 2026-07-14 [email protected] Roll pub packages (flutter/flutter#189454) 2026-07-14 [email protected] [flutter_tools] Format plugin example template to match dart format (flutter/flutter#188382) 2026-07-14 [email protected] Move renamed x64->ARM benchmarks out of bringup (flutter/flutter#189400) 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 [email protected],[email protected] 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
The plugin example app generated by
flutter create -t pluginfailsdart format. Theexample/lib/main.dartit produces contains a line that exceeds 80 columns:This comes from the plugin-hook block in
templates/app/lib/main.dart.tmpl. #187443 formatted the--emptyblock of this same file, but the plugin-hook block was left untouched. This PR wraps the line after??to matchdart format's output, so newly generated plugins are formatted out of the box.I confirmed the other
flutter createtemplates (app default +--empty, module, package, plugin_ffi) are already clean, so this is the last remaining template that failed formatting.Fixes #175960.
Adds a regression test (
has correct content and formatting with plugin templateincreate_test.dart) that generates a plugin and asserts every generated.dartfile is alreadydart format-clean, mirroring the existing app and module template formatting tests.Pre-launch Checklist
///).