Skip to content

fix: support Flutter 3.47 - #215

Open
gasciaz wants to merge 5 commits into
artflutter:masterfrom
gasciaz:fix/flutter-3.47-support
Open

fix: support Flutter 3.47#215
gasciaz wants to merge 5 commits into
artflutter:masterfrom
gasciaz:fix/flutter-3.47-support

Conversation

@gasciaz

@gasciaz gasciaz commented Aug 15, 2026

Copy link
Copy Markdown

Problem

flutter pub get crashes on Flutter 3.47, so the repo can't be bootstrapped at all:

Upgrading analysis_options.yaml to exclude build and platform directories.
Assertion failed: (package:yaml_edit) Failed to produce valid YAML after modification.
#3 AnalysisOptionsMigration.migrate
   (package:flutter_tools/src/migrations/analysis_options_migration.dart:87:22)

AnalysisOptionsMigration appends build/** to the exclude list in packages/reactive_forms_generator/analysis_options.yaml. That list is flow-style with a trailing comma, so yaml_edit emits , build/**] — invalid YAML — and the tool aborts. Upstream yaml_edit bug, avoided here by not using a flow-style list.

Commits

  1. Convert the exclude list to block style — removes the crash. Also drops the leading slash from the freezed/g.dart globs: /**/*.g.dart anchored to the filesystem root, so it never matched and generated files were never actually excluded.
  2. Stabilise the other two analysis_options.yaml — they don't crash, but Flutter 3.47 rewrites both on every flutter pub get, dirtying every contributor's working tree. Pre-populating the entries makes the migration a no-op. Verified idempotent.
  3. Update pubspec.lock — 7 SDK-pinned packages.
  4. Bump CI to Flutter 3.47.0.
  5. Fix the generator formatting check — it ran dart format --set-exit-if-changed lib from the repo root, where no lib/ 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:

Step Result
melos bootstrap SUCCESS, 4 packages
annotations / generator — analyze, format No issues, 0 changed
generator_testsdart test 34/34
example — build_runner, analyze, test 65 outputs, no issues, 28/28

Confirmed both ways: with the current master file melos bootstrap reproduces the assertion, with the fix it succeeds.

`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.
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.

1 participant