-
-
Notifications
You must be signed in to change notification settings - Fork 7
GettingStarted
This documentation is based on Squadron version 6.0. To use Squadron in your project, make sure you reference the squadron package from your pubspec.yaml file:
dependencies:
squadron: ^6.0.0
# ...
# other dependencies used by your app
# ...For the best development experience, it is highly recommended to use squadron_builder along with squadron. While Squadron provides all the building blocks to implement cross-platform multithreading, using Squadron on its own requires writing a fair amount of boilerplate code.
Squadron comes with a set of annotations that can be used to decorate service classes and methods intended to run in their own threads. These annotations will be used at build time by squadron_builder to generate the boilerplate code automatically.
To enable code generation, the first step is to add a development dependency to build_runner and squadron_builder:
dev_dependencies:
build_runner:
squadron_builder: ^6.0.0
# ...
# other dev dependencies used by your app
# ...The next step is to create a build.yaml file to activate code generation by squadron_builder:
targets:
$default:
builders:
squadron_builder:worker_builder:
enabled: true
# ...
# other builder configurations, eg. json_serializable
# ...The build process is handled by build_runner. The following command will have the code generated:
dart run build_runner build|
|
Squadron - Multithreading and worker pools in Dart. Offload CPU-bound and long running tasks and give your mobile and Web apps some air! |