Skip to content

Conversation

@AlexV525
Copy link
Member

@AlexV525 AlexV525 commented Jul 17, 2025

What does this change?

Generated files are being formatted based on confusing conditions. The PR refactored how we construct the Dart formatter in a more elegant manner.

  1. The formatter will try to find a valid Dart SDK constraint from pubspec.yaml / pubspec.lock. Otherwise, it will fall back to using the current Dart SDK version as the constraint. The behavior is like:
    1. When the user is using Dart SDK 3.8.0, pubspec.yaml has ^3.4.0, and pubspec.lock resolves ^3.7.0, the formatter will format like 3.4.0.
    2. When the runner is being used for testing purposes, which the specified pubspec file does not contain environment - sdk (and likely does not have a pubspec.lock), the formatter will format based on the current Dart SDK version.
  2. The formatter will try to find a valid page width from analysis_options.yaml - formatter - page_width / pubspec.yaml - flutter_gen - line_length, then prepend the format width header to make all format tools respect the config.

Type of change

  • New feature (non-breaking change which adds functionality)

@AlexV525 AlexV525 force-pushed the feat/write-format-width branch from d6a2a3e to db47401 Compare July 17, 2025 01:07
@codecov
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.60%. Comparing base (12ea28d) to head (8200369).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
packages/core/lib/settings/config.dart 90.90% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #697      +/-   ##
==========================================
- Coverage   96.61%   96.60%   -0.01%     
==========================================
  Files          23       24       +1     
  Lines         856      883      +27     
==========================================
+ Hits          827      853      +26     
- Misses         29       30       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexV525 AlexV525 marked this pull request as ready for review July 17, 2025 01:51
@AlexV525 AlexV525 merged commit e7c9291 into main Jul 17, 2025
4 of 5 checks passed
@AlexV525 AlexV525 deleted the feat/write-format-width branch July 17, 2025 02:56
@AlexV525 AlexV525 mentioned this pull request Jul 17, 2025
AlexV525 added a commit that referenced this pull request Jul 17, 2025
## 5.11.0

**Feature**

- [#576](#576) Add support
for deferred components. by [@ianmaciel](https://github.com/ianmaciel)
- [#676](#676) Add new
option `parse_animation` to parse metadata for animated images. by
[@huandu](https://github.com/huandu)
- [#680](#680) Add svg
`ColorMapper` to svg loader. by [@AlexV525](https://github.com/AlexV525)
- [#685](#685) Use `.vec`
SVG class for `vector_graphics_compiler` transformed assets. by
[@Albert221](https://github.com/Albert221)
- [#697](#697) Refactor
how generated files are being formatted. by
[@AlexV525](https://github.com/AlexV525)

**Development**

- [#681](#682) Bump
`dart_style` v3 which also requires Dart 3.4. by
[@AlexV525](https://github.com/AlexV525)
- [#682](#682) Add Facts
generate utils. by [@AlexV525](https://github.com/AlexV525)
- [#694](#694) Use
fine-grained logger instead of `stdout.writeln`. by
[@AlexV525](https://github.com/AlexV525)
- [#698](#698) Improve
workflow with automatic formatting. by
[@AlexV525](https://github.com/AlexV525)
- [#699](#699) Allow
`build 3.0.0`. by [@davidmorgan](https://github.com/davidmorgan)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants