Easy to use isolates for Dart and Flutter.


Almost as easy to use as compute, but using a long lived isolate. For example:

void main() async {
  final statefulIsolate = StatefulIsolate();
  final computation = statefulIsolate.isolate;
  print(await computation(_isPrime, 7));
  print(await computation(_isPrime, 42));

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

Remember to always dispose once you are done using the isolate to clean up and close the isolate.


Different backpressure strategies are also supported by just sending in the desired strategy:

Isolated(backpressureStrategy: DiscardNewBackPressureStrategy());

Currently supported strategies can be found in the documentation.

Additional information

The API of this package is not final, and is subject to change.

Breaking change

  • integral_isolates v0.4.0: deprecated the class Isolated in favor of StatefulIsolate. The class TailoredStatefulIsolate was also added, adding support for an isolate that allows for specifying input and output types.

Are you using hooks?

Try the use_isolate package that controls the lifecycle of the isolate, so you don't have to.