Skip to content
pubscout

flutter_isolate

2.1.0, released 2 years ago by an unverified publisher

Run Dart isolates in Flutter that can interact with Flutter plugins.

$ flutter pub add flutter_isolate
Source repository

What it does

Allows you to spawn and manage Dart isolates in Flutter that have access to platform plugins. It provides APIs similar to standard isolates along with `flutterCompute` to execute expensive tasks off the main thread.

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

Use it when

  • You need to run long-running or CPU-intensive background tasks that must interact with Flutter plugins
  • You want to offload work from the main UI thread on Android and iOS

Skip it when

  • Standard Dart isolates or Flutter's built-in compute function are sufficient and plugin access inside the isolate is not required
  • You want automatic event loop termination when work completes (FlutterIsolates require explicit termination)

Strengths

  • Enables plugin usage inside spawned background isolates
  • Supports custom plugin registrants for both iOS and Android
  • Provides a simple `flutterCompute` wrapper for single tasks

Weaknesses

  • Event loop will not terminate automatically, requiring explicit `kill()` calls
  • Has not been tested with a wide range of plugins
  • Entrypoints require specific `@pragma('vm:entry-point')` annotations to prevent release mode crashes

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
1

Entrypoint functions must be top-level or static and decorated with @pragma('vm:entry-point'). Custom plugin registrants may need platform-specific configuration in Swift or Java.

import 'package:flutter_isolate/flutter_isolate.dart';

@pragma('vm:entry-point')
void someFunction(String arg) {
  print("Running in an isolate with argument : $arg");
}

void runIsolate() {
  FlutterIsolate.spawn(someFunction, "hello world");
}

Alternatives

Packages that do the same job and could replace flutter_isolate.

Works with

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