Skip to content
pubscout

squadron_builder

9.3.2, released 3 months ago by d-markey.ovh

Dart code generator for Squadron workers to bridge the gap with Web Workers and Isolates.

$ flutter pub add squadron_builder
Source repository

What it does

Generates code for Workers and WorkerPools based on service classes annotated to run in dedicated threads. Bridges the gap between your worker service and Web Workers or Isolates.

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

Use it when

  • You are using Squadron for multithreading and need to generate worker and worker pool code.
  • You want to offload CPU-bound and long running tasks to Web Workers or Isolates in Dart.

Skip it when

  • You are not using the Squadron concurrency library.
  • You prefer writing manual isolate and web worker boilerplate without code generation.

Strengths

  • Automates boilerplate generation for workers and worker pools.
  • Bridges web workers and isolates seamlessly for Squadron services.

Weaknesses

  • Requires build runner / code generation setup.
  • Strictly tied to the Squadron package ecosystem.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
7

Install as a development dependency and configure build_runner alongside the squadron package.

@SquadronService(baseUrl: '~/workers', targetPlatform: TargetPlatform.vm | TargetPlatform.web)
base class HelloWorld {
  @squadronMethod
  FutureOr<String> hello([String? name]) {
    name = name?.trim() ?? 'World';
    return 'Hello, $name!';
  }
}

Alternatives

Packages that do the same job and could replace squadron_builder.

  • code_builder

    A fluent, builder-based library for generating valid Dart code programmatically.

  • build_version

    Generate a Dart file with the package version at build time.

  • flutter_gen_runner

    Generates strongly-typed Dart classes for Flutter assets, fonts, and colors to avoid string-based APIs.

  • flutter_gen

    A code generator for your assets, fonts, and colors to eliminate string-based APIs.

Works with

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