Skip to content
pubscout

integral_isolates

0.5.1, released 3 years ago by lohnn.se

Easy to use isolates for Dart and Flutter using a long-lived isolate.

$ flutter pub add integral_isolates
Source repository

What it does

Provides a long-lived isolate mechanism similar to Dart's compute function. Supports tailored input and output types, isolate streams, and backpressure handling strategies.

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

Use it when

  • You need to run heavy computations repeatedly using a long-lived isolate
  • You want to handle backpressure for intense computation call stacks

Skip it when

  • You only need a single fire-and-forget background computation task where Dart's built-in compute suffices
  • You want a fully finalized and frozen API (the package API is still subject to change)

Strengths

  • Long-lived isolate execution avoids repeated spawn overhead
  • Built-in backpressure strategies to prevent memory exhaustion
  • Tailored stateful isolates for type safety

Weaknesses

  • API is not final and is subject to change
  • Requires manual disposal of isolates to free resources

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
void main() async {
  final statefulIsolate = StatefulIsolate();
  print(await statefulIsolate.compute(_isPrime, 7));
  statefulIsolate.dispose();
}

bool _isPrime(int value) {
  if (value == 1) {
    return false;
  }
  for (int i = 2; i < value; ++i) {
    if (value % i == 0) {
      return false;
    }
  }
  return true;
}

Alternatives

Packages that do the same job and could replace integral_isolates.

Works with

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