iso
1.0.0, released 6 years ago by an unverified publisher
Runs code in a Dart isolate with bidirectional stream communication.
Repository archived
What it does
Provides a runner to launch a top‑level function in a separate isolate. It exposes streams to send data to the isolate and receive data back, handling lifecycle and disposal.
AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to offload heavy computation to a background isolate
- You require real‑time two‑way communication between UI and isolate
Skip it when
- Simple async tasks that don't need an isolate
- You need platform‑specific APIs that isolates can't access
Strengths
- Simple API for isolate management
- Bidirectional streams make continuous data exchange easy
- Handles isolate lifecycle and disposal
Weaknesses
- Only works with top‑level or static functions
- No code generation or advanced state management features
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
import 'package:iso/iso.dart';
void run(IsoRunner iso) {
iso.receive();
iso.dataIn.listen((d) => iso.send('Echo: $d'));
}
void main() async {
final iso = Iso(run, onDataOut: print);
iso.run();
await iso.onCanReceive;
iso.send('Hello');
}Alternatives
Packages that do the same job and could replace iso.
Works with
Packages commonly used together with iso: ones it builds on, ones built on it, and its own family.