Repository navigation
Conversation
|
To preview the documentation for this pull request, visit the following URL: docs.page/fluttercommunity/flutter_workmanager~745
|
…round engines BackgroundWorker created its headless FlutterEngine with project: nil, so every task built a fresh FlutterDartProject whose settings can differ from the main engine's. Add WorkmanagerPlugin.setDartProject(_:) so the host app can share one project with the background engines. Behavior is unchanged when it is not called.
zkrige
force-pushed
the
feat/apple-shared-dart-project
branch
from
October 21, 2026 04:28
ec31a4e to
a68d284
Compare
This branch has not been deployed
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.
Summary
BackgroundWorkercreates the headlessFlutterEnginewithproject: nil(BackgroundWorker.swift:159-163on main). Flutter then builds a newFlutterDartProjectfor it, so its settings can differ from the main engine's. Flutter's ownspawnWithEntrypointshares the project instead (FlutterEngine.mm:1575-1577).I hit this with Shorebird code push. A new project re-resolves the newest downloaded patch. If a patch downloads while the app runs, the background engine loads a snapshot that does not match the running VM and the process aborts in
Dart_CreateIsolateGroup.This adds
WorkmanagerPlugin.setDartProject(_:). The host app creates oneFlutterDartProjectat launch, shares it with its engine and passes it here, andBackgroundWorkerhands it to the engine.Opt-in: if
setDartProjectis never called,dartProjectstaysniland the engine is created exactly as before.The README/docs change is a short note in
docs/quickstart.mdx. I did not edit the CHANGELOG, since melos generates it from the PR title.Tested
flutter build ios --debug --no-codesigninexample: builtRunner.appflutter testinworkmanager_apple: all 28 tests passBackgroundWorkerneeds a Flutter engine, so per AGENTS.md it is not unit-testable.