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.
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.
93Compare - build_version
Generate a Dart file with the package version at build time.
77Compare - flutter_gen_runner
Generates strongly-typed Dart classes for Flutter assets, fonts, and colors to avoid string-based APIs.
87Compare - flutter_gen
A code generator for your assets, fonts, and colors to eliminate string-based APIs.
87Compare
Works with
Packages commonly used together with squadron_builder: ones it builds on, ones built on it, and its own family.
- analyzersquadron_builder depends on itPerforms static analysis of Dart code for tool integration and embedding.
- pub_semversquadron_builder depends on itVersions and version constraints implementing pub's versioning policy.
- dart_stylesquadron_builder depends on itProvides an API and CLI to format Dart source code automatically.
- buildsquadron_builder depends on itPackage for authoring build_runner compatible code generators.
- source_gensquadron_builder depends on itSource code generation builders and utilities for the Dart build system.
- squadronsquadron_builder depends on itMultithreading and worker thread pools for Dart and Flutter using Isolates and Web Workers.
- build_runnerUsed togetherA build system for Dart code generation and modular compilation.