Skip to content

fix: Bump the minimum Flutter version to 3.47.0 and Dart to 3.13.0 - #4087

Merged
spydon merged 2 commits into
mainfrom
chore/bump-flutter-3-47
Oct 2, 2026
Merged

spydon merged 2 commits into
mainfrom
chore/bump-flutter-3-47

Conversation

@spydon

@spydon spydon commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Description

Raises the minimum supported Flutter version to 3.47.0 and the Dart SDK floor to 3.13.0 in every package, the melos bootstrap environment and the CI minimum version, brings flame_lint up to the Dart 3.13 lint set, and migrates the whole workspace to primary constructors.

flame_lint

  • Bumps lints to ^6.1.0.
  • Replaces the strict-casts analyzer option with the no_dynamic_casts rule that supersedes it in Dart 3.13.
  • Removes the deprecated avoid_private_typedef_functions and unnecessary_await_in_return rules.
  • Renames no_runtimeType_toString, prefer_for_elements_to_map_fromIterable and prefer_iterable_whereType to their new lowercase names.
  • Adds the new rules from Dart 3.4 through 3.13 that fit the code base: async_return_with_no_await, combinators_ordering, deprecated_member_use_from_same_package, empty_container_bodies, initialize_in_field_declaration, invalid_runtime_check_with_js_interop_types, missing_code_block_language_in_doc_comment, no_literal_bool_comparisons, no_self_assignments, simple_directive_paths, simplify_variable_pattern, unnecessary_const_in_enum_constructor, unnecessary_ignore, unnecessary_library_directive, unnecessary_library_name, unnecessary_null_aware_operator_on_extension_on_nullable, unnecessary_primary_constructor_body, unnecessary_underscores, unnecessary_unawaited, use_null_aware_elements, use_primary_constructors and use_truncating_division.
  • Deliberately leaves out unnecessary_type_name_in_constructor, since we do not want to write new(...) instead of the class name when declaring constructors (Foo.new tear-offs are still fine), as well as specify_nonobvious_property_types, document_ignores, remove_deprecations_in_breaking_versions, matching_super_parameters and switch_on_type, which do not match how the code base is written.
  • Drops use_declaring_parameters, which flags parameters that are forwarded to inherited setters and cannot become fields, and use_late_for_private_fields_and_variables and avoid_field_initializers_in_const_classes, which contradict initialize_in_field_declaration now that field initializers can reference constructor parameters.

Primary constructors

The second commit enables use_primary_constructors and rewrites every class, enum and mixin to the Dart 3.13 primary constructor syntax, including the empty () header the rule requires on declarations without an explicit constructor. The automated fix needed manual repair in a number of places:

  • Twelve @immutable classes with non-constant field initializers were given a const primary constructor that cannot be constant. The const is removed and prefer_const_constructors_in_immutables is ignored on them, since the lint does not account for field initializers that reference declaring parameters.
  • Fields that were both initialized in their declaration and through a declaring parameter or initializer list now have a single source.
  • MutableRect keeps its explicit constructor, since @override fields cannot be declaring parameters.
  • Constructor doc comments that only restated the class doc are dropped, the informative ones are merged into the class doc, and the packages that enforce public_member_api_docs keep a documented this; body.

Code changes

  • Applies dart fix for the new rules across the workspace (empty class bodies now end with ;, sorted combinators, dropped library names, removed unnecessary ignores, null aware elements and so on) and formats everything with the Dart 3.13 formatter, which now separates imports into sections.
  • Awaits the futures returned from async functions flagged by async_return_with_no_await.
  • Removes the stale Flutter 3.35 compatibility imports in flame_3d and the Transform2D test.
  • Removes the no-op self assignments in the bouncing ball example and types the close callback in the Jenny example to avoid an implicit dynamic cast.

CI

  • FLUTTER_MIN_VERSION is now 3.47.0 and the lowest supported version analyze job covers flame_3d again, since the lowest version is the latest stable.

Verified locally on Flutter 3.47.5: dart analyze --fatal-infos, dart format --set-exit-if-changed, dcm analyze . and the cspell script are clean, and all package test suites pass except the golden pixel diffs that already fail on main on macOS.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • [-] I have updated/added tests for ALL new/updated/fixed functionality.
  • [-] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • [-] I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

spydon added 2 commits October 1, 2026 19:17
Raises the SDK floor in every package, the melos bootstrap environment
and the CI minimum version, and updates flame_lint to the Dart 3.13
lint set:

- Bumps lints to ^6.1.0 and replaces the `strict-casts` analyzer option
  with the `no_dynamic_casts` rule that supersedes it.
- Removes the deprecated `avoid_private_typedef_functions` and
  `unnecessary_await_in_return` rules and renames the three rules whose
  names were lowercased.
- Adds the new rules from Dart 3.4 through 3.13 that fit the code base,
  such as `async_return_with_no_await`, `empty_container_bodies`,
  `use_null_aware_elements`, `unnecessary_ignore`, `combinators_ordering`
  and `unnecessary_library_name`. The `unnecessary_type_name_in_constructor`
  rule is left out on purpose, since we do not want to write `new(...)`
  instead of the class name in constructor declarations.
- Applies the resulting fixes across the workspace and formats the code
  with the Dart 3.13 formatter.
- Uses a private initializing formal in ParticleEmitterComponent and
  removes the stale Flutter 3.35 compatibility imports.
- Restores the lowest supported version analyze job to cover flame_3d,
  since the lowest version is the latest stable again.
…tructors

Adds the `use_primary_constructors` rule to flame_lint and rewrites every
class, enum and mixin in the workspace to the Dart 3.13 primary
constructor syntax, including the empty `()` header the rule requires on
declarations without an explicit constructor.

The automated fix needed a fair amount of manual repair:

- Twelve `@immutable` classes with non-constant field initializers got a
  `const` primary constructor that cannot be constant. The `const` is
  removed and `prefer_const_constructors_in_immutables` is ignored on
  them, since the lint does not account for field initializers that
  reference declaring parameters.
- Fields that were both initialized in their declaration and through a
  declaring parameter or initializer list now have a single source.
- MutableRect keeps its explicit constructor, since `@override` fields
  cannot be declaring parameters.
- Constructor doc comments that only restated the class doc are dropped,
  the informative ones are merged into the class doc, and packages that
  enforce `public_member_api_docs` keep a documented `this;` body.
- `use_declaring_parameters`, `use_late_for_private_fields_and_variables`
  and `avoid_field_initializers_in_const_classes` are dropped from
  flame_lint: the first flags parameters that are forwarded to inherited
  setters and cannot become fields, and the other two contradict
  `initialize_in_field_declaration` now that field initializers can
  reference constructor parameters.
@spydon
spydon merged commit 53cea03 into main Oct 2, 2026
9 checks passed
@spydon
spydon deleted the chore/bump-flutter-3-47 branch October 2, 2026 14:39
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