Skip to content
pubscout

worker_manager

7.2.9, released 7 months ago by renesanse.net

Manage CPU-intensive calculations across isolates with reusable workers and cancellation.

WASM-ready
$ flutter pub add worker_manager
Source repository

What it does

Worker Manager is a library that helps efficiently manage CPU-intensive tasks across Dart isolates. It offers reusable isolates, task cancellation, gentle cancellation, and inter-isolate communication via ports to prevent app freezes.

AI-written summary of version 7.2.9, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to run heavy CPU-bound computations without freezing the UI
  • You want to reuse isolates instead of spawning a new one via compute every time
  • You need to cancel running background tasks or communicate via ports

Skip it when

  • You only need simple asynchronous I/O operations
  • You are running very short tasks where isolate startup overhead outweighs benefits

Strengths

  • Reusable isolates prevent CPU overload
  • Task cancellation and gentle cancellation support
  • Inter-isolate communication with ports

Weaknesses

  • Functions passed must be static methods, globally defined functions, or lambdas
  • On web before isolate support, fallback executes similarly to compute method

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4

not documented

Cancelable<ResultType> cancelable = workerManager.execute<ResultType>(
  () async {
    // Your CPU-intensive function here
  },
  priority: WorkPriority.immediately,
);

Alternatives

Packages that do the same job and could replace worker_manager.

  • squadron

    Multithreading and worker thread pools for Dart and Flutter using Isolates and Web Workers.

  • isolate_channel

    Communication channels for isolates based on Flutter's platform channels.

  • isolated_worker

    Singleton isolated worker for running heavy tasks in isolates on Flutter and web workers on web.

Works with

Packages commonly used together with worker_manager: ones it builds on, ones built on it, and its own family.