-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Option 1 breaks dart format . --set-exit-if-changed checks (as commonly used in pipelines), as the generated file does not comply the dart format rules. We should format the the generated files by default.
It's independent from if the files are checked into git or not.
Providing format: true in l10n.yaml wouldn't solve this in all scenarios, as users might have custom project formatting with dart format . -l 120 option, which the generation tool not knows about.
See: #102983 (comment)
See: Dart-Code/Dart-Code#4482 (comment)
Steps to reproduce
Scenario 1
- Checkout example: https://github.com/flutter/flutter/tree/master/dev/benchmarks/test_apps/stocks
- Remove the
format: trueoption inl10n.yaml, which would be the default after following the migration guide - Run
[path/to/]flutter pub get(commonly done in ci pipelines) [path/to/]dart format . --set-exit-if-changedreturns 1 (commonly done in ci pipelines)
Workarounds:
- Add the
format: trueoption inl10n.yaml(should be added to the migration guide)
Solutions:
- Make
format: truethe default in Flutter, as why it shouldn't be formatted in the first place, as it is a controlled output by flutter (non-breaking in my opinion) (feat: Arbitrary format options for localizations generation (#102983) #167029)
Scenario 2
- Checkout example: https://github.com/flutter/flutter/tree/master/dev/benchmarks/test_apps/stocks
- Keep the
format: trueoption inl10n.yaml - Format your code with
dart format . -l 120(as preferred option in some projects) - Run
[path/to/]flutter pub get(commonly done in ci pipelines) [path/to/]dart format . --set-exit-if-changed -l 120returns 1 (commonly done in ci pipelines), as some lines might can take advantage of arbitrary format options
Workarounds:
- Run
dart format [path/to/localizations] -l 120before runningdart format . --set-exit-if-changed -l 120
Solutions:
- Arbitrary format options for localizations generation (feat: Arbitrary format options for localizations generation (#102983) #167029)
Expected results
Scenario 1: format localization by default
Scenario 2: provide arbitrary format options for localization generation
Actual results
Scenario 1: The format option is not enabled by default
Scenario 2: No additional / arbitrary format options for localization generation exist
Code sample
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
[!] Flutter (Channel main, 3.32.0-1.0.pre.73, on Microsoft Windows [Version 10.0.22631.5039], locale de-DE) [2,8s]
• Flutter version 3.32.0-1.0.pre.73 on channel main at D:\Tmp\Coding\git\flutter\flutter
! Warning: `flutter` on your path resolves to C:\src\flutter\bin\flutter, which is not inside your current Flutter SDK checkout
at D:\Tmp\Coding\git\flutter\flutter. Consider adding D:\Tmp\Coding\git\flutter\flutter\bin to the front of your path.
! Warning: `dart` on your path resolves to C:\src\flutter\bin\dart, which is not inside your current Flutter SDK checkout at
D:\Tmp\Coding\git\flutter\flutter. Consider adding D:\Tmp\Coding\git\flutter\flutter\bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision a7f820163c (2 weeks ago), 2025-04-11 18:24:16 -0700
• Engine revision a7f820163c
• Dart version 3.8.0 (build 3.8.0-265.0.dev)
• DevTools version 2.45.0-dev.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform
update checks and upgrades.
[√] Windows Version (11 Home 64-bit, 23H2, 2009) [5,8s]
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [8,2s]
• Android SDK at C:\src\android\Sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = C:\src\android\Sdk
• Java binary at: C:\Program Files\Java\jdk-17.0.1\bin\java
This JDK is specified by the JAVA_HOME environment variable.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
• All Android licenses accepted.
[√] Chrome - develop for the web [465ms]
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.5.3) [463ms]
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.5.33516.290
• Windows 10 SDK version 10.0.22621.0
[!] Android Studio (not installed) [270ms]
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/to/windows-android-setup for detailed instructions).
[√] IntelliJ IDEA Ultimate Edition (version 2025.1) [270ms]
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.1
• Flutter plugin version 85.2.4
• Dart plugin version 251.25267.1
[√] VS Code (version 1.96.4) [28ms]
• VS Code at C:\Users\Gustl\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.102.0
[√] Connected device (3 available) [479ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.5039]
• Chrome (web) • chrome • web-javascript • Google Chrome 135.0.7049.85
• Edge (web) • edge • web-javascript • Microsoft Edge 135.0.3179.98
[√] Network resources [519ms]
• All expected network resources are available.
! Doctor found issues in 2 categories.