Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d-markey/squadron_builder
Dart code generator for Squadron workers. Implement your worker service and let squadron_builder bridge the gap with Web Workers and Isolates!
https://github.com/d-markey/squadron_builder
code-generation dart isolate parallelism-library thread webworker
Last synced: 9 days ago
JSON representation
Dart code generator for Squadron workers. Implement your worker service and let squadron_builder bridge the gap with Web Workers and Isolates!
- Host: GitHub
- URL: https://github.com/d-markey/squadron_builder
- Owner: d-markey
- License: mit
- Created: 2022-08-02T10:01:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-01T13:21:57.000Z (11 days ago)
- Last Synced: 2024-11-01T14:23:33.379Z (11 days ago)
- Topics: code-generation, dart, isolate, parallelism-library, thread, webworker
- Language: Dart
- Homepage: https://pub.dev/packages/squadron_builder
- Size: 655 KB
- Stars: 15
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
## **Squadron - Multithreading and worker pools in Dart**
Offload CPU-bound and long running tasks and give your mobile and Web apps some air!
# squadron_builder
Dart code generator for Squadron workers. Implement your worker service and let `squadron_builder` bridge the gap with Web Workers and Isolates!
[![Pub Package](https://img.shields.io/pub/v/squadron_builder)](https://pub.dev/packages/squadron_builder)
[![Dart Platforms](https://badgen.net/pub/dart-platform/squadron_builder)](https://pub.dev/packages/squadron_builder)
[![Flutter Platforms](https://badgen.net/pub/flutter-platform/squadron_builder)](https://pub.dev/packages/squadron_builder)[![License](https://img.shields.io/github/license/d-markey/squadron_builder)](https://github.com/d-markey/squadron_builder/blob/master/LICENSE)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Dart Style](https://img.shields.io/badge/style-lints-40c4ff)](https://pub.dev/packages/lints)
[![Pub Points](https://img.shields.io/pub/points/squadron_builder)](https://pub.dev/packages/squadron_builder/score)
[![Likes](https://img.shields.io/pub/likes/squadron_builder)](https://pub.dev/packages/squadron_builder/score)
[![Popularity](https://img.shields.io/pub/popularity/squadron_builder)](https://pub.dev/packages/squadron_builder/score)
[![Last Commit](https://img.shields.io/github/last-commit/d-markey/squadron_builder?logo=git&logoColor=white)](https://github.com/d-markey/squadron_builder/commits)# Usage
`squadron_builder` is a companion package to `Squadron` and is intended to be installed as a development dependency to your project.
Its purpose is to generate the code for Workers and WorkerPools based on the service classes you want to run in dedicated threads.
Example of a service class:
```dart
// this annotation tells squadron_builder that this class contains code to be executed on dedicated threads
@SquadronService(baseUrl: '~/workers', targetPlatform: TargetPlatform.vm | TargetPlatform.web)
base class HelloWorld {
// this annotation tells squadron_builder that this method is exposed to clients running in the main thread for instance
@SquadronMethod()
FutureOr hello([String? name]) {
name = name?.trim() ?? 'World';
return 'Hello, $name!';
}
}
```