squadron
Multithreading and worker thread pool for Dart / Flutter, to offload CPU-bound and heavy I/O tasks to Isolate or Web Worker threads.
7.4.3
18K downloads/mo
#2282 most downloaded on pub.dev
d-markey/squadron
What this package is like to depend on
Last release 4 months ago
04 Apr 2026
Release timing varies
gaps range from 9 days to 4 months
Most releases are documented
notes for 59 of 67 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
67 releases · first in 2021
5 releases in the last 12 months
see the full history below
Release timeline
67 releases · Sep 2021 to Apr 2026Releases
latest 60 of 67-
7.4.304 Apr 2026Release notes
Open source →- Remove deprecated artefacts.
- Add build options to control internal + cross-worker logging and travel time.
- Regroup tests to reduce the number of test files and minimize time spent compiling them.
-
7.4.221 Mar 2026Release notes
Open source →send()optimization: for non-cancellable tasks, synchronously return the future when the channel is already up and running. Otherwise, return the result asynchronously viaForwardCompleter.- Use
Stopwatchinstead ofTimestampfor worker stats. - Improved tests.
-
7.4.017 Nov 2025Release notes
Open source →- Add
Squadron.disableBrowserCacheto force browsers into reloading the code of Workers. When set totrue, Squadron will append a query parameter to the Worker URL, passing a random number that should prevent browsers from using the cache. - Add
versionparameter toSquadronServiceannotation. This parameter is used by squadron_builder to include the version as a query parameter in the generated Worker URI. See also https://github.com/d-markey/squadron_builder/issues/40.
- Add
-
7.3.015 Nov 2025Release notes
Open source →- Deprecate
localWorkerin favor ofsharedServiceandLocalWorkerClientin favor ofWorkerClient. See squadron_builder and https://github.com/d-markey/squadron/issues/75. - Add
Channel.closed, which returns aFuture<void>that completes when the channel is closed. This is the same future as the one returned byChannel.close().
- Deprecate
-
7.2.028 Sep 2025Release notes
Open source →- Support sending Dart
DateTime/ JSDateinstances to/from Workers. - Fix warnings from pub.dev.
- Support sending Dart
-
7.1.205 Jul 2025Release notes
Open source →- Expose the count of active connections via the worker's stats.
- Added tests from https://github.com/d-markey/squadron/pull/71 to check for memory leaks. Credits go to https://github.com/jpohhhh, thanks!
- Properly close
ForwardStreamControlleron VM to avoid memory leaks -- fixes https://github.com/d-markey/squadron/issues/70.
-
7.1.2+117 Aug 2025 -
7.1.131 Mar 2025Release notes
Open source →- Be less aggressive on task scheduling in Worker pools. When synchronously submitting many tasks to the pool, the
_schedulesynchronous method was systematically called and would block the event loop. This version uses a timer to avoid flooding the pool's scheduler.
- Be less aggressive on task scheduling in Worker pools. When synchronously submitting many tasks to the pool, the
-
7.1.026 Mar 2025Release notes
Open source →- New feature: annotation for generating code of local Workers
- New feature: marshaling context
Release notes
Open source →- Move stats management out of Worker into a specialized class.
- Breaking change: removed
WorkerStat.status. - Remove accessors to
ConcurrencySettingsproperties inWorkerPool. - Update tests.
-
7.0.016 Mar 2025Release notes
Open source →- Implement serialization contexts to ser-/deser-ialize while retaining object identities. For instance, when calling a service method
myServiceMethod(x, x), previous versions of Squadron would serializextwice, resuling in two different instances on the receiving end. UsingContextAwareConverter,xcan be serialized only once and the same serialized representation ofxwould be used for the second argument. Note that this also supports serialization of graph of objects, including those with cyclical references. - Local services can now be plain Dart classes -- squadron_builder will take care of generating the operations map. No need de derive from
WorkerServiceanymore. - New annotation for squadron_builder:
SquadronService.local()to indicate the service may run as a local service;localWorkerto be applied on parameters used to pass a local service on to a worker (only supported for start requests);withContextparameter toSquadronMethodto force use of a marshaling context when ser-/deser-ializing to/from that service method.
- Implement serialization contexts to ser-/deser-ialize while retaining object identities. For instance, when calling a service method
-
6.2.012 Jan 2025Release notes
Open source →- Implement
jsify/dartify-like functions to handle conversion between Dart / JavaScript. The implementation supports arbitraryMaps,Lists andSets, as well asBigInts. - When converting a message to JS, the list of transferable objects is populated at the same time if required.
- Reworked tests & activate Wasm tests.
- Reworked test Web console (CSS by ChatGPT).
- Implement
-
6.1.625 Dec 2024Release notes
Open source →- Fix
IWorker.terminate()to make sure worker termination is really immediate.
- Fix
-
6.1.521 Dec 2024Release notes
Open source →- Fix a bug where streaming operations in workers are not cancelled if the worker has been stopped before the subscription is cancelled.
- Update unit tests.
- Update examples.
-
6.1.415 Dec 2024Release notes
Open source →- Add
IWorker.terminate()to enable immediate termination of workers and worker pools. - Refactor tests + browser test console + add unit tests for thread termination.
- Add
-
6.1.317 Nov 2024Release notes
Open source →- Handle weird case where
intis received asJSStringwhen worker was compiled to Web Assembly. Fixes https://github.com/d-markey/squadron_builder/issues/23.
- Handle weird case where
-
6.1.213 Nov 2024Release notes
Open source →- Remove
DirectCastConverterand useCastConverterinstead. Fixes https://github.com/d-markey/squadron_builder/issues/22. - Remove method
Converter.td<T>()for handling typed data. Instead, conversion should be based onTypedDataMarshaler<T>, combined withSquadron.converterwhen necessary (eg. when the typed data list is nested in a map / list).
- Remove
-
6.1.102 Nov 2024Release notes
Open source →Squadron.convertershould be modifiable but it was declaredfinal: implement getter and setter.- Interested artefacts can register callbacks with
Squadron.onConverterChanged()to be notified after the converter has been updated.
-
6.1.002 Nov 2024Release notes
Open source →- Implement specific marshaler for
TypedData(used bysquadron_builder>= 6.1.0).
- Implement specific marshaler for
-
6.0.420 Oct 2024Release notes
Open source →- Breaking change: the connection channel is provided to caller before the service is installed (when the service is mixed in with
ServiceInstaller); if service installation fails, the channel is closed and the caller is notified with an error and anendOfStreamresponse. - Change
tokentype toCancelationTokeninLocalWorkerClient.send(). - Add support for annotating service classes to be used as local workers.
- Breaking change: the connection channel is provided to caller before the service is installed (when the service is mixed in with
-
6.0.324 Sep 2024 -
6.0.223 Sep 2024 -
6.0.123 Sep 2024 -
6.0.022 Sep 2024Release notes
Open source →- /!\ BREAKING CHANGES /!\
- Merged
worker_monitorintoworker_runner. - Removed
SerializeWithannotation. - Removed custom cancelation token implementations and switched to
package:cancelation_token. - Removed custom logger implementations and switched to
package:loggerfor logging. - Reworked the Squadron singleton.
- Worker methods
send()andstream()are no longer generic: they returnFuture<dynamic>andStream<dynamic>. It is now the user responsibility to ensure service arguments and return values are properly handled in terms of Dart type. One major caveat comes from Web Assembly, where Dartintvalues sent from one side are received as Dartdoublevalues on the other side. To help with conversions, Squadron provides converters and selects the proper converter depending on the runtime platform, so you can "cast" values on either side of the service call (seeSquadron.convertersinsquadron_singleton.dart). The recommendation is to use squadron_builder to generate the code for your workers -- it will take care of casting and marshaling. - Reworked unit tests, and made unit tests cover VM, JS/JS and JS/Wasm scenarios. Wasm/JS and Wasm/Wasm are not unit tested yet.
- Published the test console to enable testing of all combinations.
- Also published the test coverage report.
-
5.1.615 Sep 2023Release notes
Open source →- Reworked exception deserializer management to protect from multiple registrations and allow for deregistration. See https://github.com/d-markey/squadron/issues/27#issuecomment-1717452323.
- Added support for installable/uninstallable worker services. If a service needs to take action after the worker thread has started or before it is stopped, it should extend or implement
ServiceInstallerand provide one or both ofinstall()/uninstall(). These methods will be called on platform thread setup/teardown. See https://github.com/d-markey/squadron/issues/29#issuecomment-1719682340.
-
5.1.510 Sep 2023Release notes
Open source →- Removed
stdout_logger.dartbecause it importsdart:iowhich made pub.dev revoke the support for Web platforms.
- Removed
-
5.1.409 Sep 2023Release notes
Open source →- BREAKING CHANGE: Removed
squadron_service.dart,squadron_worker.dartandsquadron_local_worker.dartlibraries: import onlysquadron.dartinstead. - Added check to verify Web worker entry point exists upon error.
- Reorganized source code.
- Added topics and funding to pubspec.
- BREAKING CHANGE: Removed
-
5.1.327 Jun 2023Release notes
Open source →- Add unit test raising a 'Null check operator used on a null value' exception when cancelling a streaming service method + stopping the worker.
- Fix 'Null check operator used on a null value' exception when cancelling a streaming service method + stopping the worker.
-
5.1.222 Jun 2023Release notes
Open source →- Fix 'marshal' typo -- provide a compatibility layer to mark as deprecated all versions using 'marshall' and mark these artefacts as deprecated. They will eventually be removed.
PlatformWorkerHookandEntryPointaliases now returnFutureOr<void>.
-
5.1.107 Jun 2023Release notes
Open source →- Use
DateTime.now().toUtc()instead ofDartTime.timestamp()which is available starting from Dart 3 only. Fixes https://github.com/d-markey/squadron/issues/22.
- Use
-
5.1.006 Jun 2023Release notes
Open source →- Make
WorkerRequestandWorkerResponsealiases ofListto minimize serialization overhead. Replace previousWorkerRequestandWorkerResponseimplementations with extension methods. This may be a breaking change. - Add
EntryPointandPlatformWorkertypedefs to enforce type safety across runtime platforms.EntryPointandPlatformWorkershould both resolve todynamicin the IDE. At compile time, they should resolve to the concrete types according to the platform (ie.StringandWorkerfromdart:htmlfor Web platforms,FutureOr<void> Function(List)andIsolateon native platforms). This should help prevent issues such as https://github.com/d-markey/squadron/issues/17. - Provide access to platform worker instance upon initialization. See https://github.com/d-markey/squadron/issues/20.
- Make
-
5.0.012 May 2023Release notes
Open source →- Enable support of Dart 3.
- Breaking change: use
Listinstead ofMapfor serialization of worker request/response.
-
4.3.805 May 2023Release notes
Open source →- Downgrade
metaversion to^1.8.0to matchflutter_testrequirements (fix for https://github.com/d-markey/squadron/issues/18).
- Downgrade
-
4.3.729 Apr 2023Release notes
Open source →- Ensure uniqueness of cancellation token IDs across workers (breaking change for classes implementing/deriving from
CancellationToken:idis now aString).
- Ensure uniqueness of cancellation token IDs across workers (breaking change for classes implementing/deriving from
-
4.3.611 Mar 2023Release notes
Open source →- Downgrade
metaversion to^1.8.0to matchflutter_testrequirements. - Fix pool scheduler algorithm to ensure worker availability before dispatching tasks.
- Downgrade
-
4.3.502 Mar 2023Release notes
Open source →- Add
UseLoggerannotation to have package squadron_builder generate the associated code in worker threads.
- Add
-
4.3.419 Feb 2023Release notes
Open source →- Add notifications when a worker is added or removed. Interested components can register listeners (callbacks) for these notifications.
- Disable automatic log-forwarding between workers and their parents. It is possible to restore this behaviour manually by using [ParentSquadronLogger] as a logger during initialization of the platform worker.
- Split logging logic between message formatting vs. emitting.
-
4.3.318 Oct 2022Release notes
Open source →- Rename
SquadronSerializertoSquadronMarshaller. - Update dev dependencies.
- Rename
-
4.3.201 Oct 2022Release notes
Open source →WorkerResponse: ifresultis anIterablebut not aList, calltoList()to get results before serializing the response back to the caller.SerializeWith: annotation used to indicate how to marshal data to/from a service running in a Worker. See alsoSquadronSerializerclass.
-
4.3.114 Sep 2022Release notes
Open source →CancellationToken: provideFuture<bool> isCancelled({bool throwIfCancelled = false})to make it easier to check cancellation token status in worker services.
-
4.3.022 Aug 2022Release notes
Open source →ValueWrapper: check future hasn't already completed before callingcomplete()orcompleteError().
-
4.2.002 Aug 2022 -
4.1.002 Aug 2022Release notes
Open source →- Now with annotations to support code generation. To be used with package
squadron-builder.
- Now with annotations to support code generation. To be used with package
-
4.0.013 May 2022Release notes
Open source →- Breaking changes: all deprecated artefacts have been removed.
- Breaking change:
LocalSquadronLoggerhas been deleted. - Breaking change: the
argsandtokenarguments of methodssend()andstream()are now named argument. - Breaking change: removed the optional
idparameter that was passed toWorkerconstructors. - Breaking change: disabled message inspection for Web channels. In previous versions, Squadron would inspect each piece of data exchanged via
_JsChannels to identify objects whose ownership must be transfered to the receiving end (thetransferargument inpostMessage). However most of the time, the request / response objects are usually made ofList,Map, and base types, all of which can cross thread boundaries "as-is". This behavior is now controlled by optional parametersinspectRequestandinspectResponseof methodsWorker.execute()andWorker.stream(), defaulting tofalsethus disabling message inspection. Passingtruewill activate message inspection for request and/or response and will be necessary when the message contains an object whose ownership must be transfered to the receiving end, typicaly aMessagePort. Basic testing found message transfer time improvement around ~5-10% for large payloads, e.g. aListcontaining manyMapitems (note that in Web scenarios, JSON serialization could prove a more efficient alternative). It should have little to no effect on smaller messages. Start requests will always be processed withinspectRequest = trueandinspectResponse = true. - Fixed issue with workers on native platforms: ensure all
ReceivePortsare closed uponIsolatetermination. - Support logging accross workers (which made
LocalSquadronLoggerobsolete). - Added support to reset the Squadron singleton.
- Reworked examples & unit tests.
Release notes
Open source →- Breaking changes: all deprecated artefacts have been removed.
- Breaking change:
LocalSquadronLoggerhas been deleted. - Breaking change: the
argsandtokenarguments of methodssend()andstream()are now named argument. - Breaking change: removed the optional
idparameter that was passed toWorkerconstructors. - Breaking change: disabled message inspection for Web channels. In previous versions, Squadron would inspect each piece of data exchanged via
_JsChannels to identify objects whose ownership must be transfered to the receiving end (thetransferargument inpostMessage). However most of the time, the request / response objects are usually made ofList,Map, and base types, all of which can cross thread boundaries "as-is". This behavior is now controlled by optional parametersinspectRequestandinspectResponseof methodsWorker.execute()andWorker.stream(), defaulting tofalsethus disabling message inspection. Passingtruewill activate message inspection for request and/or response and will be necessary when the message contains an object whose ownership must be transfered to the receiving end, typicaly aMessagePort. Basic testing found message transfer time improvement around ~5-10% for large payloads, e.g. aListcontaining manyMapitems (note that in Web scenarios, JSON serialization could prove a more efficient alternative). It should have little to no effect on smaller messages. Start requests will always be processed withinspectRequest = trueandinspectResponse = true. - Fixed issue with workers on native platforms: ensure all
ReceivePortsare closed uponIsolatetermination. - Support logging accross workers (which made
LocalSquadronLoggerobsolete). - Added support to reset the Squadron singleton.
- Reworked examples & unit tests.
-
3.4.023 Apr 2022Release notes
Open source →- Rewritten streaming implementations (fix for https://github.com/d-markey/squadron/issues/8).
- Added unit tests.
-
3.3.206 Apr 2022Release notes
Open source →- Implemented a
LocalLoggerto have Web workers log messages from the main window (effectively logging via Dart debugger if present). - Removed import of
dart:isolatefrom_worker_runner.dart. - Made
coveragea dev dependency. - Added a tool to extract coverage metrics during Github Dart workflow.
- Updates badges to include coverage metrics and platform info.
- Implemented a
-
3.3.102 Apr 2022Release notes
Open source →- Fixed streaming from
LocalWorker. - Added tests for
LocalWorker. - Improved cancellation handling.
- Added tests to improve test coverage.
- Fixed streaming from
-
3.3.026 Mar 2022Release notes
Open source →- Implemented
LocalWorker, a worker-like class living in the same thread as its owner and available for inter-worker messaging. For instance, in a Flutter app, instantiating aLocalWorkerin the main thread enables other workers to (indirectly) call Flutter APIs that are otherwise not available in the context of a secondary thread. LocalWorkeruses the same concepts and approach asWorkers, such as theoperationsmap and theWorkerServiceinterface.
- Implemented
-
3.2.220 Mar 2022Release notes
Open source →- Document types and release mode (special thanks to SwissCheese5).
- More error handling at communication points.
- Use lower log levels for internal Squadron log messages.
- Added test coverage.
-
3.2.109 Feb 2022Release notes
Open source →- Document the new logging feature.
- Make
sendRequest()async in browserChannel(implementation closer to that of nativeChannel). - Add a timestamp to pool workers to record the time when it was assigned its last task.
- Sort pool workers to distribute tasks to those that have the largest capacity and the oldest timestamp.
- Add command property to
WorkerException. - Reorganized the test folder.
- Recompiled test Web workers.
-
3.2.006 Feb 2022Release notes
Open source →- Added a logging mechanism to facilitate debugging Squadron's internals.
- Reworked connection flow between main program and worker.
- Reworked task scheduling.
- Fixed issue https://github.com/d-markey/squadron/issues/3.
- Added tests for logging and workers failing to initialize.
-
3.1.501 Dec 2021Nothing published for this version
-
3.1.5+131 Jan 2022Nothing published for this version
-
3.1.427 Nov 2021Release notes
Open source →- Implemented cancellation token to enable worker task notification that cancellation has occured.
- Implemented
TimeOutToken,CancellableTokenandCompositeToken. - Updated
README.md. - Added unit tests.
-
3.1.321 Nov 2021Nothing published for this version
-
3.1.220 Nov 2021Nothing published for this version
-
3.1.120 Nov 2021Nothing published for this version
-
3.1.020 Nov 2021Release notes
Open source →- Several minor changes (some possibly breaking changes but easy to fix).
- Split library into
squadron_service.dart(worker services only),squadron_worker.dart(worker services and workers without pool) vs.squadron.dart(worker services, workers and pools). - Split
ChannelintoChannel(used to send aWorkerRequest) andWorkerChannel(used to send aWorkerResponse). - Added
ConcurrencySettingsto eventually replaceminWorkers,maxWorkersandmaxParallel. - Added
WorkerPool.execute()(will eventually replaceWorkerPool.compute()). - Added
WorkerPool.scheduleTask()to schedule aValueTask. Result will be accessible from futureValueTask.value. - Added
WorkerPool.scheduleStream()to schedule aStreamTask. Results will be accessible from streamStreamTask.stream. ValueTaskandStreamTaskprovide information on task execution (eg. status, wait time, execution time...).- Added
WorkerPool.cancel()to support worker task cancellation. - Updated
README.md. - Added unit tests.
-
3.0.014 Nov 2021Release notes
Open source →- Split library into
squadron_service.dart(worker services only),squadron.dart(worker services and workers without pool) vs.squadron_pool.dart(worker services, workers and pools). - Moved
connect()andprocess()from Worker to WorkerService. - Provided the
run()function to facilitate implementation of platform workers. - Adapted tests and examples.
- Updated
README.md.
- Split library into
-
2.0.224 Oct 2021Release notes
Open source →- Single test code base for both platforms.
- Added BitCoin service to test live network access from workers (courtesy of coindesk.com).
- Added PiDigits service (related to https://github.com/d-markey/squadron/issues/1).
- Retaining attempts based on manually operating a browser to run tests in /web (different test code base) and /test/browser-tests (same test code base).
-
2.0.116 Oct 2021