Releases: brewkits/native_workmanager
v1.0.8 — DartWorker iOS fix, path traversal hardening, Koin hot restart
What's Fixed
- iOS: DartWorker works in debug / integration-test mode —
FlutterCallbackCachereturns nil in JIT builds; fixed by routing through the existing main method channel instead of a secondary engine. All iOS integration tests now pass. - iOS: DartWorker callback input correctly decoded — input was wrapped as
{'raw': '...'}instead of the actual decoded map; callbacks now receive{'key': 'value'}as expected. - iOS: False disk-space failure on small downloads — removed the fixed 50 MB constant from
hasEnoughDiskSpace(); formula now matches Android:requiredBytes × 1.2. - iOS: Chain cancel handle stored before execution —
handleEnqueueChainnow stores the Task handle inactiveTasksbefore starting, socancel()finds it correctly. - iOS: Chain enqueue was blocking — returns
"ACCEPTED"immediately; result delivered via EventChannel. - iOS: Data race on
taskStartTimes— all reads/writes now usestateQueuewith.barrierwrites. - Android: Hot restart skipped Koin reload —
isKoinInitializednow reset inonDetachedFromEngine(). - Android: Path traversal hardened — replaced
contains("..")withFile.canonicalPathacross all 7 workers. - Android:
HttpDownloadWorkernull body NPE —response.body!!replaced with explicit null check. - Dart:
TaskEventnull-safety — replaced unsafe casts with null-safe fallbacks. - Dart:
TaskEvent.operator==ignoredmessage— fixed equality to includemessagefield. - README: API examples corrected — all 9 code sample inaccuracies fixed against the actual Dart API.
Version Alignment
pubspec.yaml, native_workmanager.podspec, and android/build.gradle all set to 1.0.8.
v1.0.7 — Fix iOS custom workers (input never reached doWork)
What's Fixed
Critical: iOS custom workers silently failed since initial implementation
NativeWorker.custom(className:, input:) on iOS — the user-supplied input dictionary was never passed to doWork(). Root cause: executeWorkerSync() serialised the full internal workerConfig (which contains workerType, className, and the input as a nested JSON string) instead of extracting and passing the pre-encoded input payload. Custom workers received wrapper fields instead of their own parameters, so every parameter lookup returned nil and every task silently failed.
Fix: Extract workerConfig["input"] as? String when present; fall back to full config for built-in workers. Applied to both the foreground path (executeWorkerSync) and the background path (BGTaskSchedulerManager.executeWorker).
What's Improved
doc/use-cases/07-custom-native-workers.md: corrected return types (Boolean/Bool→WorkerResult), fixed Android registration hook, iOS@main+import native_workmanager, broken file referenceREADME.md: custom-worker row in comparison table + full showcase section with Kotlin/Swift/Dart examples- Demo app: Custom Workers tab now runs real
NativeWorker.custom()calls - Integration tests: Group 10 "Custom Native Workers" — 3 new tests (32 total passing)
SimpleAndroidWorkerFactory:Log.efor unknown class instead of silentnull
Upgrade
flutter pub upgrade native_workmanagerFull changelog: CHANGELOG.md
v1.0.6
v1.0.6 — Thread Safety, SDK Constraint, Topics
Fixed
-
Android: Thread safety —
taskTags,taskStatuses,taskStartTimesreplaced withConcurrentHashMap(NativeWorkmanagerPlugin.kt)mutableMapOf()(LinkedHashMap) is not thread-safe; concurrent coroutine access could silently corrupt data or throwConcurrentModificationExceptionunder load
-
iOS: Memory safety —
onTaskCompleteclosure now capturesinstanceweakly (NativeWorkmanagerPlugin.swift)BGTaskSchedulerManager.shared.onTaskCompleteimplicitly captured the plugin instance strongly; the adjacentprogressDelegatealready used[weak instance]correctly
Changed
- Topics added —
background,workmanager,networking,files,cryptographyfor pub.dev discoverability - SDK constraint —
sdk: '>=3.6.0 <4.0.0',flutter: '>=3.27.0'(fixes pub.dev static analysis / "unknown platforms") - Lint rules —
cancel_subscriptions,close_sinks,avoid_returning_null_for_future,always_declare_return_typesand more
Upgrade
native_workmanager: ^1.0.6v1.0.5 - Trigger/Constraint Correctness, SPM Support, QA Fixes
v1.0.5 — Trigger/Constraint Correctness, SPM Support, QA Fixes
Added
-
Swift Package Manager (SPM) support for iOS — works with both SPM and CocoaPods
- Added
ios/native_workmanager/Package.swiftwithbinaryTargetfor the bundled KMPWorkManager XCFramework andZIPFoundationdependency - Moved Swift sources to
ios/native_workmanager/Sources/native_workmanager/(Flutter SPM layout) - Resolves partial pub.dev platform score for SPM support
- Added
-
Device integration test suite — GROUP 1–9 covering all trigger types, ExistingPolicy, all 11 workers, chains, tags, cancellation, events, progress, and DartWorker constraint & delay enforcement
Fixed (Critical — Android periodic tasks)
-
Trigger type hardcoded to
OneTime— periodic/exact/windowed triggers were silently ignored (NativeWorkmanagerPlugin.kt)- Every task was treated as one-shot. Periodic tasks only ran once; exact/windowed triggers were completely ineffective
- Full trigger parsing now switches on the
"type"key and creates the correctTaskTriggersubtype
-
ExistingTaskPolicyhardcoded toKEEP— users could not replace existing tasks -
Constraints hardcoded to defaults —
requiresNetwork,requiresCharging,backoffPolicy,isHeavyTask, andsystemConstraintswere silently ignored -
Periodic tasks stopped emitting events after first execution —
Flow.first {}unsubscribed after first terminal state- Periodic tasks now use
takeWhile { state != CANCELLED }.collect {}
- Periodic tasks now use
Fixed (iOS)
flexMskey lookup used wrong nameflexIntervalMs— flex window always nil- Constraints ignored
qosandexactAlarmIOSBehavior - Chain resume dropped all worker config values — all config lost after app kill
- Initial task state set to
"running"instead of"pending" - Custom worker registration always silently skipped —
#if canImport(ClassName)is always false IosWorkerprotocol andIosWorkerFactorywereinternal— host apps could not register custom workersWorkerErrorundefined;WorkerResult.success(data:)wrong type in example
Fixed (QA round)
- Android:
CancellationExceptionswallowed in 3 Flow-collection coroutines — coroutines leaked on plugin detach - Android:
HttpDownloadWorkerdeleted temp file on network error — broke resume - Android:
ImageProcessWorkersampleSizecould be 0 —maxOf(1, min(...))prevents zero sample size - iOS:
CryptoWorkerloaded file before size check — OOM crash on large files fixed; random salt now used instead of hardcoded string
Upgrade
dependencies:
native_workmanager: ^1.0.5v1.0.4 - WorkManager 2.10.0+ Compatibility Fix
🐛 Critical Bug Fix
Android: Worker crash "IllegalStateException: Not implemented" - FIXED
The Problem
All Android users were experiencing crashes when using WorkManager 2.10.0+:
IllegalStateException: Not implemented
at androidx.work.CoroutineWorker.getForegroundInfo(CoroutineWorker.kt:92)
The Solution
✅ Upgraded to kmpworkmanager 2.3.3 which adds proper getForegroundInfo() override
✅ Now safe to use with work-runtime-ktx 2.10.1+
✅ Includes notification i18n support and chain routing fixes
Impact: All expedited tasks now work without crashing on WorkManager 2.10.0+
🎯 What's Fixed
Core Fixes
- Android crash fix: Proper
getForegroundInfo()implementation for expedited tasks - Chain routing fix: Heavy tasks (
isHeavyTask=true) now correctly useKmpHeavyWorker - Notification i18n: Notification strings now support localization via Android resources
Example App Improvements
- ✅ Added interactive Bug Fix Demo tab proving WorkManager 2.10.0+ compatibility
- ✅ Added comprehensive integration tests for bug verification
- ✅ Fixed Flutter rendering error in Chain Resilience Test screen
- ✅ Fixed integration test API usage
- ✅ Corrected competitor library naming in benchmarks
Documentation
- 📄 Complete bug fix verification guide (
BUG_FIX_VERIFICATION.md) - 📄 Migration guide (no code changes required - just upgrade!)
📦 Dependencies Updated
- kmpworkmanager: 2.3.1 → 2.3.3 (fixes WorkManager 2.10.0+ compatibility)
- work-runtime-ktx: 2.9.1 → 2.10.1 (safe with kmpworkmanager 2.3.3+)
🚀 Migration Guide
No code changes required! Just upgrade:
dependencies:
native_workmanager: ^1.0.4 # was ^1.0.3Then:
flutter pub get
flutter clean
flutter build apk🙏 Credits
Special thanks to Abdullah Al-Hasnat for reporting this critical bug and providing detailed reproduction steps.
📊 Verification
- ✅ All 808 tests passing
- ✅ Android build verified from Maven Central
- ✅ iOS build verified
- ✅ Bug fix demo confirms no crashes
- ✅ Integration tests validate WorkManager 2.10.0+ compatibility
All users should upgrade to v1.0.4 immediately.
v1.0.3 - Critical Android Fix
🔴 CRITICAL FIX - Android Users Must Upgrade
Bug Fixed
- Android: Fixed
IllegalStateException: KmpWorkManager not initialized! - Impact: Versions 1.0.0, 1.0.1, and 1.0.2 were completely non-functional on Android
- Root Cause: Plugin was missing
KmpWorkManager.initialize()call
What Changed
// Added in NativeWorkmanagerPlugin.kt
KmpWorkManager.initialize(
context = context,
workerFactory = SimpleAndroidWorkerFactory(context),
config = KmpWorkManagerConfig()
)Upgrade Instructions
- Update
pubspec.yaml:dependencies: native_workmanager: ^1.0.3
- Run:
flutter pub get flutter clean
New Documentation
- 📘 Android Setup Guide
- 📘 Enhanced troubleshooting in FAQ
Acknowledgments
Reported by: Abdullah Al-Hasnat
iOS Status
✅ iOS not affected - no changes needed
All Android users should upgrade immediately.
v1.0.2 - Critical Android Fix
🔴 CRITICAL FIX - Android Users Must Upgrade
Bug Fixed
- Android: Fixed
IllegalStateException: KmpWorkManager not initialized! - Impact: Versions 1.0.0 and 1.0.1 were completely non-functional on Android
- Root Cause: Plugin was missing
KmpWorkManager.initialize()call
What Changed
// Added in NativeWorkmanagerPlugin.kt
KmpWorkManager.initialize(
context = context,
workerFactory = SimpleAndroidWorkerFactory(context),
config = KmpWorkManagerConfig()
)Upgrade Instructions
- Update
pubspec.yaml:dependencies: native_workmanager: ^1.0.2
- Run:
flutter pub get flutter clean
New Documentation
- 📘 Android Setup Guide - Comprehensive Android configuration
- 📘 Enhanced troubleshooting in FAQ and Getting Started
Acknowledgments
Reported by: Abdullah Al-Hasnat - Thank you for the detailed error report!
iOS Status
✅ iOS not affected - no changes needed
All Android users should upgrade immediately.
v1.0.1 - Pub.dev Compliance Fix
🎯 Native WorkManager v1.0.1 - Pub.dev Compliance Fix
Metadata improvement to achieve perfect pub.dev score (160/160 points).
🔧 What Changed
Fixed
- Package Description: Shortened from 215 to 154 characters
- Compliance: Now meets pub.dev requirement (60-180 chars)
- Score Impact: 150/160 → 160/160 points ✅
📊 Before vs After
| Metric | v1.0.0 | v1.0.1 | Status |
|---|---|---|---|
| Description Length | 215 chars | 154 chars | ✅ Fixed |
| Pub Points | 150/160 | 160/160 | ✅ Perfect |
| Compliance | Failed | Passed | ✅ Full |
📝 Details
This is a metadata-only release with no code changes. It addresses the package description length issue identified in pub.dev's automated analysis of v1.0.0.
Old Description (215 chars):
"Native background task manager for Flutter. Zero Flutter Engine overhead. 50MB less memory, 5x faster startup. Built on kmpworkmanager v2.3.1 (Android + iOS) with critical bug fixes, security hardening, Koin scope isolation, and iOS chain reliability improvements."
New Description (154 chars):
"Native background task manager for Flutter. Zero Flutter Engine overhead. 50MB less memory, 5x faster startup. Built on kmpworkmanager v2.3.1."
The shortened description maintains all key value propositions while meeting pub.dev's publishing guidelines.
🚀 Installation
dependencies:
native_workmanager: ^1.0.1🔗 Links
- pub.dev: https://pub.dev/packages/native_workmanager
- Changelog: https://github.com/brewkits/native_workmanager/blob/main/CHANGELOG.md
- v1.0.0 Release: https://github.com/brewkits/native_workmanager/releases/tag/v1.0.0
Note: All features and functionality from v1.0.0 remain unchanged. This release only improves package metadata for better pub.dev compliance.
v1.0.0 - Production Ready
🚀 Native WorkManager v1.0.0 - Production Ready
Native background task manager for Flutter with zero Flutter Engine overhead.
📊 Performance Improvements
Compared to standard Flutter background solutions:
| Metric | native_workmanager | flutter_workmanager | Improvement |
|---|---|---|---|
| RAM Usage | 35 MB | 85 MB | 58% less |
| Startup Time | 70 ms | 525 ms | 7.5x faster |
| Engine Overhead | 0 MB | ~50 MB | Zero |
✨ Key Features
11 Built-in Native Workers
Execute common tasks in pure Kotlin/Swift without loading the Flutter Engine:
- HTTP Operations: Request, Sync, Download, Upload (with resume support)
- File Operations: Copy, Move, Delete, Zip, Unzip
- Media Processing: Image resize/compress
- Cryptography: Hash, Encrypt, Decrypt
- Dart Fallback: Custom logic with engine caching & auto-dispose
Task Chains
Automate multi-step workflows entirely in native code:
await NativeWorkManager.beginWith(
TaskRequest(
id: 'download',
worker: HttpDownloadWorker(
url: 'https://cdn.example.com/data.zip',
savePath: '/tmp/data.zip',
supportResume: true,
),
),
).then(
TaskRequest(
id: 'unzip',
worker: FileDecompressionWorker(
inputPath: '/tmp/data.zip',
outputPath: '/tmp/extracted/',
),
),
).enqueue();Benefits:
- Auto-retry with exponential backoff
- Resume support for long-running tasks
- Survives app restarts (persisted state)
- Automatic dependency management
🔒 Production Quality
Testing & Validation
- ✅ 808 passing tests (unit, integration, performance)
- ✅ 150/160 pub points on pub.dev
- ✅ Security validations (path traversal, URL filtering, file size limits)
- ✅ Memory leak testing with LeakCanary
Documentation
- 25+ comprehensive guides
- 15+ interactive demo examples
- 7 real-world use cases
- Complete API reference
Platform Support
- iOS: 12.0+ (BGTaskScheduler)
- Android: API 21+ (WorkManager)
- Full platform feature parity
🛠 What's New in v1.0.0
iOS Improvements
- Eliminated all unsafe force unwraps (zero crash risk)
- Enhanced error handling with guard statements
- Chain data flow with state persistence
- Auto-resume after app kill
Android Improvements
- Optimized engine lifecycle management
- Improved WorkManager integration
- Better resource cleanup
API Improvements
- Shortened package description for pub.dev compliance
- Improved error messages
- Better TypeScript-style API documentation
Testing Improvements
- Added proper platform channel mocking
- Fixed chain data flow test initialization
- 13 new passing tests
📦 Installation
dependencies:
native_workmanager: ^1.0.0Then run:
flutter pub get🔗 Links
- pub.dev: https://pub.dev/packages/native_workmanager
- Documentation: https://github.com/brewkits/native_workmanager/tree/main/doc
- Examples: https://github.com/brewkits/native_workmanager/tree/main/example
- Getting Started: https://github.com/brewkits/native_workmanager/blob/main/doc/GETTING_STARTED.md
💬 Feedback
Found a bug or have a feature request? Open an issue
🙏 Acknowledgments
Built on kmpworkmanager v2.3.1 - a battle-tested KMP wrapper around WorkManager (Android) and BGTaskScheduler (iOS).
Full Changelog: https://github.com/brewkits/native_workmanager/blob/main/CHANGELOG.md