magic_isolate library

A lightweight wrapper around Dart isolates that removes the SendPort/ReceivePort handshake boilerplate — spawn, communicate, and close isolates through one simple object.

Classes

MagicIsolate
A simple, single-object wrapper around a Dart isolate that removes the manual ReceivePort/SendPort handshake boilerplate.
MagicWorker
Runs inside a spawned isolate and removes the manual ReceivePort/SendPort handshake boilerplate.

Typedefs

MagicIsolateMessageHandler = void Function(dynamic message)
A callback invoked for every message received from the worker isolate, except messages that were awaited via MagicIsolate.request.
MagicIsolateWorker = void Function(SendPort mainSendPort)
A top-level or static function that will run inside the spawned isolate.
MagicWorkerHandler = FutureOr Function(dynamic message)
A handler that processes an incoming message on the worker side.