fix: Bump the minimum Flutter version to 3.47.0 and Dart to 3.13.0 - #4087
Merged
Merged
Conversation
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.
2 of 3 tasks
erickzanardo
approved these changes
Oct 2, 2026
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.
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_lintup to the Dart 3.13 lint set, and migrates the whole workspace to primary constructors.flame_lint
lintsto^6.1.0.strict-castsanalyzer option with theno_dynamic_castsrule that supersedes it in Dart 3.13.avoid_private_typedef_functionsandunnecessary_await_in_returnrules.no_runtimeType_toString,prefer_for_elements_to_map_fromIterableandprefer_iterable_whereTypeto their new lowercase names.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_constructorsanduse_truncating_division.unnecessary_type_name_in_constructor, since we do not want to writenew(...)instead of the class name when declaring constructors (Foo.newtear-offs are still fine), as well asspecify_nonobvious_property_types,document_ignores,remove_deprecations_in_breaking_versions,matching_super_parametersandswitch_on_type, which do not match how the code base is written.use_declaring_parameters, which flags parameters that are forwarded to inherited setters and cannot become fields, anduse_late_for_private_fields_and_variablesandavoid_field_initializers_in_const_classes, which contradictinitialize_in_field_declarationnow that field initializers can reference constructor parameters.Primary constructors
The second commit enables
use_primary_constructorsand 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:@immutableclasses with non-constant field initializers were given aconstprimary constructor that cannot be constant. Theconstis removed andprefer_const_constructors_in_immutablesis ignored on them, since the lint does not account for field initializers that reference declaring parameters.MutableRectkeeps its explicit constructor, since@overridefields cannot be declaring parameters.public_member_api_docskeep a documentedthis;body.Code changes
dart fixfor 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.asyncfunctions flagged byasync_return_with_no_await.flame_3dand theTransform2Dtest.CI
FLUTTER_MIN_VERSIONis now 3.47.0 and the lowest supported version analyze job coversflame_3dagain, 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
docsand added dartdoc comments with///.examplesordocs.Breaking Change?