fix: support Flutter 3.47 - #215
Open
gasciaz wants to merge 5 commits into
Open
Conversation
`flutter pub get` crashes on Flutter 3.47. Flutter's
AnalysisOptionsMigration appends `build/**` to the exclude list, but the
list is flow-style with a trailing comma, so yaml_edit produces invalid
YAML and the tool aborts:
Assertion failed: (package:yaml_edit) Failed to produce valid YAML
after modification.
artflutter#3 AnalysisOptionsMigration.migrate
(package:flutter_tools/src/migrations/analysis_options_migration.dart:87:22)
Convert the list to block style and pre-populate the entries the
migration wants, so it becomes a no-op.
Also drop the leading slash from the freezed/g.dart globs. `/**/*.g.dart`
anchored the pattern to the filesystem root, so it never matched and
generated files were in practice never excluded.
These two files do not crash, but Flutter 3.47 rewrites both on every `flutter pub get`, leaving every contributor with a dirty working tree. Pre-populate the exclude entries the migration wants so it becomes a no-op. Verified idempotent: identical checksums after repeated `melos bs` runs. Also remove two dead commented-out lines in the example config.
Seven SDK-pinned packages (intl, matcher, meta, test, test_api, test_core, vector_math) plus the recorded SDK floor moving to Dart 3.11.
Without this the analysis_options fix is not actually covered by CI. Verified locally on Flutter 3.47.0 / Dart 3.13.0: melos bs, analyze and format on all packages, generator_tests 34/34, example build_runner + 28/28.
The step ran `dart format --set-exit-if-changed lib` from the repository
root, where no `lib/` directory exists. dart format exits 0 on a missing
path, so the check has always passed without inspecting anything:
$ dart format --set-exit-if-changed lib
No file or directory found at "lib".
Formatted no files in 0.00 seconds.
exit=0
Adding the missing cd makes it real. It passes: 44 files, 0 changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
flutter pub getcrashes on Flutter 3.47, so the repo can't be bootstrapped at all:AnalysisOptionsMigrationappendsbuild/**to theexcludelist inpackages/reactive_forms_generator/analysis_options.yaml. That list is flow-style with a trailing comma, soyaml_editemits, build/**]— invalid YAML — and the tool aborts. Upstreamyaml_editbug, avoided here by not using a flow-style list.Commits
freezed/g.dartglobs:/**/*.g.dartanchored to the filesystem root, so it never matched and generated files were never actually excluded.analysis_options.yaml— they don't crash, but Flutter 3.47 rewrites both on everyflutter pub get, dirtying every contributor's working tree. Pre-populating the entries makes the migration a no-op. Verified idempotent.pubspec.lock— 7 SDK-pinned packages.dart format --set-exit-if-changed libfrom the repo root, where nolib/exists.No source code touched, no dependency constraints changed, no version bump.
Verification
Every CI step reproduced locally on Flutter 3.47.0 / Dart 3.13.0:
melos bootstrapgenerator_tests—dart testexample— build_runner, analyze, testConfirmed both ways: with the current
masterfilemelos bootstrapreproduces the assertion, with the fix it succeeds.