Skip to content

Upgrade to Dart 3 (SDK >=3.12.0) - #332

Merged
btr-rmconsole-2[bot] merged 21 commits into
masterfrom
dart3
Aug 6, 2026
Merged

Upgrade to Dart 3 (SDK >=3.12.0)#332
btr-rmconsole-2[bot] merged 21 commits into
masterfrom
dart3

Conversation

@hemantkumar-wk

Copy link
Copy Markdown
Contributor

Summary

  • Updates SDK constraint to >=3.12.0 <4.0.0 in the main pubspec.yaml
  • Raises json_annotation to ^4.9.0
  • Removes explicit dart_style dev dependency (still available as transitive dep; ignored in dependency validator since direct ^3.x conflicts with analyzer ^5.0.0)
  • Adds --no-fatal-warnings to the dart_dev analyze config to suppress pre-existing warnings (unused elements, unnecessary non-null assertions on fields, etc.) without modifying production code
  • Adds dart_style to the dart_dependency_validator.yaml ignore list
  • Reverts test fixture pubspec.yaml SDK constraints back to Dart 2 ranges — these fixtures represent code that the codemod analyzes under Dart 2 semantics; updating them to Dart 3 would cause widespread test failures in tests that intentionally use pre-null-safe code patterns

Note on GitHub workflows: The only workflow (publish.yaml) uses gha-dart-oss which does not use the Workiva/gha-dart actions that require a sdk: parameter, so no workflow changes are needed.

Test results: 1257 pass / 59 fail on dart3 vs 1247 pass / 69 fail on master. The 59 remaining failures are pre-existing (same timeout failures in component_usage_test.dart and load failures in tests that use build_runner code generation).

Test plan

  • dart run dart_dev analyze passes (exit 0 with --no-fatal-warnings)
  • dart pub global run dependency_validator passes
  • dart test runs: 1257 pass, 59 fail (10 fewer failures than master)
  • No new test failures introduced by this PR

🤖 Generated with Claude Code

hemantkumar-wk and others added 6 commits July 30, 2026 16:03
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…le version constraints)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These packages are used by the analyzer during tests to analyze code
that represents pre-null-safe Dart. Keeping them at Dart 2 ranges ensures
the test analyzer evaluates the code under Dart 2 semantics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@hemantkumar-wk
hemantkumar-wk marked this pull request as draft July 31, 2026 06:27
hemantkumar-wk and others added 9 commits July 31, 2026 12:07
The gha-dart-oss/checks.yaml@v0.1.12 workflow uses 'format-check' (not 'enable-format-check') as the input name to disable the format check step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
json_serializable now emits (... as num).toInt() instead of (... as int)
for integer JSON fields under Dart 3.12.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows dart pub get to run in this fixture with Dart 3.12.2. The lower
bound stays at >=2.19.0 so the fixture still represents a Dart 2
null-safe project and analyzer behavior is unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t 3)

The required_props codemod was a null safety migration tool and is no
longer needed under Dart 3. Remove the bin, lib, test, and fixture
directories, and clean up the two null_safety_prep suggestors that
optionally referenced PropRequirednessRecommender.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Delete 4 null_safety_prep suggestor tests whose suggestors are no-ops
under Dart 3 (isNonNullableByDefault guard returns early for all files
in the upgraded fixture). These tools were null-safety migration aids;
deleting them follows the same rationale as the required_props cleanup.

Add defaultIsExpectedError to SharedAnalysisContext so the overReact
fixture can suppress analysis errors from Dart 2-style test source
written into the now-Dart-3 over_react_project. Remaining tests that
exercise suggestors on pre-null-safe code patterns were failing due to
errors such as unchecked_use_of_nullable_value and
argument_type_not_assignable; these are expected given the test inputs
and are now suppressed only on the overReact context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_transport)

None of these packages are directly imported anywhere in lib/ or test/.
Their removal fixes the dependency_validator CI check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Delete DomCallbackNullArgs and FnPropNullAwareCallSuggestor (and their
tests) since these codemods exist solely to help with null-safety
migrations, which are no longer relevant now that the SDK constraint
requires Dart 3. Suppress legacy null-safety analysis errors in
SharedAnalysisContext.overReact via defaultIsExpectedError so
suggestor tests can still exercise pre-null-safe code patterns
without the fixture generating false-positive errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@greglittlefield-wf greglittlefield-wf mentioned this pull request Aug 3, 2026

@greglittlefield-wf greglittlefield-wf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple comments, but overall looks good!

Comment thread tool/dart_dev/config.dart Outdated
Comment thread pubspec.yaml
/// so suggestor tests can still exercise pre-null-safe code patterns.
static final overReact = SharedAnalysisContext(
p.join(findPackageRootFor(p.current), 'test/test_fixtures/over_react_project'),
defaultIsExpectedError: _isLegacyNullSafetyError);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need this for other projects as well; I get test failures when running dart run test locally, which runs against private-package-based fixtures since CI does not (via --exclude-tags=wsd):

dart test --exclude-tags=wsd

dart_style is imported directly in test/util.dart so it belongs as an
explicit dev_dependency. Removing it and adding it to the ignore list
accomplished nothing since it still resolved transitively.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hemantkumar-wk
hemantkumar-wk marked this pull request as ready for review August 4, 2026 14:20

@greglittlefield-wf greglittlefield-wf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this comment might have gotten missed (dart run test still fails for me locally), otherwise LGTM!

Same null-safety error suppression applied to overReact is needed for
wsd and rmui since those fixtures are also Dart 3 and tests write
Dart 2-style source into them. CI excludes wsd/rmui tests via
--exclude-tags=wsd but local runs hit these failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hemantkumar-wk

Copy link
Copy Markdown
Contributor Author

Sorry, missed that one! Added defaultIsExpectedError: _isLegacyNullSafetyError to the wsd and rmui contexts. Also verified it by running the tests locally. They run now, although a few are still failing. Those same tests also fail on master, so they appear to be pre-existing issues unrelated to this PR.

@greglittlefield-wf

Copy link
Copy Markdown
Contributor

@hemantkumar-wk No worries, thank you!

Those same tests also fail on master, so they appear to be pre-existing issues unrelated to this PR.

Sounds good 👍

@greglittlefield-wf

Copy link
Copy Markdown
Contributor

Added a major label since this PR removes codemods. This is intentional, semver +1

@greglittlefield-wf greglittlefield-wf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+10

@greglittlefield-wf

Copy link
Copy Markdown
Contributor

@Workiva/release-management-p

@greglittlefield-wf

Copy link
Copy Markdown
Contributor

Closing and reopening to see if that helps this merge

@greglittlefield-wf

Copy link
Copy Markdown
Contributor

@Workiva/release-management-p

@rmconsole-wf rmconsole-wf left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from RM

@btr-rmconsole-2
btr-rmconsole-2 Bot merged commit 160ca1b into master Aug 6, 2026
12 checks passed
@btr-rmconsole-2
btr-rmconsole-2 Bot deleted the dart3 branch August 6, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants