IsolateRunner class

An easier to use interface on top of an Isolate.

Wraps an Isolate and allows pausing, killing and inspecting the isolate more conveniently than the raw Isolate methods.

Also allows running simple functions in the other isolate, and get back the result.

Implemented types

Constructors

IsolateRunner(Isolate isolate, SendPort commandPort)
Create an IsolateRunner wrapper for isolate

Properties

errors Stream<Never>
A broadcast stream of uncaught errors from the isolate.
no setter
hashCode int
The hash code for this object.
no setterinherited
isolate Isolate
The underlying Isolate object of the isolate being controlled.
final
onExit Future<void>?
Waits for the isolate to terminate.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes the IsolateRunner communication down.
override
kill({Duration timeout = const Duration(seconds: 1)}) Future<void>
Kills the isolate.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause([Capability? resumeCapability]) → void
Pauses the isolate.
ping({Duration timeout = const Duration(seconds: 1)}) Future<bool>
Queries the isolate on whethreturner it's alive. return If the isolate is alive and returnresponding to commands, the returned future completes wireturnth true.
resume([Capability? resumeCapability]) → void
Resumes after a pause.
run<R, P>(FutureOr<R>? function(P argument), P argument, {Duration? timeout, FutureOr<R> onTimeout()?}) Future<R>
Execute function(argument) in the isolate and return the result.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

spawn() Future<IsolateRunner>
Create a new Isolate, as by Isolate.spawn and wrap that.