Skip to content

fix: Allow code_assets 2.x - #122

Closed
dzolotov wants to merge 1 commit into
flame-engine:mainfrom
pleiondev:chore/code-assets-2
Closed

dzolotov wants to merge 1 commit into
flame-engine:mainfrom
pleiondev:chore/code-assets-2

Conversation

@dzolotov

@dzolotov dzolotov commented Oct 1, 2026 •

Copy link
Copy Markdown

Description

forge2d asks for code_assets ^1.2.1, so an app that also depends on something built against code_assets 2 can't resolve at all. flutter_soloud 5.x is one such package. I ran into this while adding a package to the Flame monorepo: it reaches SoLoud through its dependencies, flame_forge2d sits in the same workspace, and the workspace stopped resolving.

This widens the constraint to ">=1.2.1 <3.0.0" and leaves hooks and native_toolchain_c alone. My first push raised the floor to ^2.1.0 instead, and that was wrong. code_assets 2 needs hooks ^2.2.0, which pulls in record_use and meta ^1.19.0. Flutter 3.44.0 pins meta to 1.18.0, so on Flame's minimum Flutter version forge2d would not resolve. With the range, 3.44.0 still gets 1.2.1 and newer SDKs can pick 2.x.

hook/build.dart doesn't change. I ran dart analyze and the whole suite at both ends of the range: code_assets 1.2.1 with hooks 2.0.0 and native_toolchain_c 0.19.0, then code_assets 2.1.0 with hooks 2.2.0 and native_toolchain_c 0.19.5. Both report only the prefer_if_elements_to_conditional_expressions info that is already on main, and all 114 tests pass on macOS arm64 with the hook building Box2D from source.

One thing that tripped me up when running the suite: test/api/length_unit_test.dart fails if all the test files share one isolate, because the length unit is process-wide and another file has already created a World. Plain dart test runs each file in its own isolate, so it's fine there. I didn't touch it.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • [-] 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.

Breaking Change

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

Related Issues

forge2d asked for code_assets ^1.2.1, so an app that also depends on a
package built against code_assets 2 (flutter_soloud, for one) could not
resolve. The constraint now takes both majors. The lower end stays,
because hooks 2.1 and later need meta 1.19, which Flutter 3.44.0 does not
ship. The build hook uses nothing that differs between the two.
@dzolotov
dzolotov force-pushed the chore/code-assets-2 branch from 03624a1 to 55ce189 Compare October 1, 2026 14:44
@dzolotov

dzolotov commented Oct 1, 2026

Copy link
Copy Markdown
Author

Closing this: I split the audio code in the package that pulled in flutter_soloud, so the Flame workspace resolves with forge2d's current constraint and nothing here needs to change.

@dzolotov dzolotov closed this Oct 1, 2026
@dzolotov
dzolotov deleted the chore/code-assets-2 branch October 1, 2026 15:17
@spydon

spydon commented Oct 1, 2026

Copy link
Copy Markdown
Member

It's a good idea to bump to ^2.0.0 anyways so I did it here: #123

@spydon

spydon commented Oct 1, 2026

Copy link
Copy Markdown
Member

@dzolotov forge2d v0.15.2 with the version bump is now released

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