Skip to content

Conversation

@ColinSchmale
Copy link

@ColinSchmale ColinSchmale commented Aug 5, 2025

Renaming the DART_TASK_KEY in commit b45313b broke the plugin.

Apps crash until users clear the cache or install the app again.

The issue is similar to PR #626.

Exception java.lang.NullPointerException:
  at dev.fluttercommunity.workmanager.BackgroundWorker.getDartTask (BackgroundWorker.java:49)
  at dev.fluttercommunity.workmanager.BackgroundWorker.startWork$lambda$6 (BackgroundWorker.java:93)
  at android.os.Handler.handleCallback (Handler.java:973)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at android.os.Looper.loopOnce (Looper.java:282)
  at android.os.Looper.loop (Looper.java:387)
  at android.app.ActivityThread.main (ActivityThread.java:9500)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:600)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1005)

I've fixed it for you using code similar to PR #626.

@docs-page
Copy link

docs-page bot commented Aug 5, 2025

To view this pull requests documentation preview, visit the following URL:

docs.page/fluttercommunity/flutter_workmanager~635

Documentation is deployed and generated using docs.page.

@ColinSchmale ColinSchmale changed the title Fix NullPointerException BackgroundWorker.getDartTask fix: NullPointerException BackgroundWorker.getDartTask Aug 5, 2025
ened added a commit that referenced this pull request Aug 5, 2025
- Remove non-null assertion operator (!!) from dartTask property
- Add null checks in all methods that use dartTask
- Handle null dart task gracefully with proper error reporting
- Fixes crash when DART_TASK_KEY is missing from worker input data

Fixes #635
@ened ened closed this in #636 Aug 6, 2025
ened added a commit that referenced this pull request Aug 6, 2025
* chore(release): publish packages

 - workmanager_apple@0.9.1
 - workmanager@0.9.0+1

* docs: fix incorrect UIBackgroundModes documentation

- Remove invalid 'processing' value from UIBackgroundModes
- Add clarification that BGTaskScheduler doesn't require UIBackgroundModes
- Link to Apple's official UIBackgroundModes documentation
- Update workmanager version to 0.9.0 in installation instructions

Fixes #633

* Revert "docs: fix incorrect UIBackgroundModes documentation"

This reverts commit 7116f5f.

* docs: improve iOS background modes documentation links

- Replace Xcode Help link with Apple's Configuration Guide
- Add link to UIBackgroundModes property list documentation
- Provide both practical configuration and technical reference links

Fixes #633

* fix: prevent NullPointerException in BackgroundWorker.getDartTask

- Remove non-null assertion operator (!!) from dartTask property
- Add null checks in all methods that use dartTask
- Handle null dart task gracefully with proper error reporting
- Fixes crash when DART_TASK_KEY is missing from worker input data

Fixes #635

* Revert "chore(release): publish packages"

This reverts commit aa9e3b6.
@ColinSchmale ColinSchmale deleted the fix/npe-darttask branch September 28, 2025 13:08
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.

1 participant