use_isolate library

Classes

BackpressureStrategy<Q, R>
Class to implement to support a backpressure strategy. This is used to make sure job queues are handled properly.
CombineBackPressureStrategy<Q, R>
An implementation of BackpressureStrategy that allows for manual merge of input data for calls to the isolate function.
DiscardNewBackPressureStrategy<Q, R>
An implementation of BackpressureStrategy that has a job queue with size one, and as long as the queue is populated all new jobs will be dropped.
IsolateGetter
Interface for exposing the compute function for a StatefulIsolate.
NoBackPressureStrategy<Q, R>
An implementation of BackpressureStrategy that uses a FIFO stack for handling backpressure.
ReplaceBackpressureStrategy<Q, R>
An implementation of BackpressureStrategy that has a job queue with size one, and discards the queue upon adding a new job.
StatefulIsolate
A class that makes running code in an isolate almost as easy as running Flutter's compute function.
TailoredIsolateGetter<Q, R>
Interface for exposing the compute function for a TailoredStatefulIsolate.
TailoredStatefulIsolate<Q, R>
A class that makes running code in an isolate almost as easy as running Flutter's compute function.

Functions

useIsolate({BackpressureStrategy? backpressureStrategy}) StatefulIsolate
A hook that exposes a StatefulIsolate.
useTailoredIsolate<Q, R>({BackpressureStrategy<Q, R>? backpressureStrategy}) TailoredStatefulIsolate<Q, R>
A hook that exposes a TailoredStatefulIsolate.

Typedefs

IsolateCallback<Q, R> = FutureOr<R> Function(Q message)
Signature for the callback passed to StatefulIsolate.compute.
IsolateComputeImpl = Future<R> Function<Q, R>(IsolateCallback<Q, R> callback, Q message, {String? debugLabel})
Data type of the implementation of the computation function.
IsolateStream<Q, R> = Stream<R> Function(Q message)
Signature for the callback passed to StatefulIsolate.computeStream.
IsolateStreamComputeImpl = Future<R> Function<Q, R>(IsolateStream<Q, R> callback, Q message, {String? debugLabel})
Data type of the implementation of the stream function.
TailoredIsolateComputeImpl<Q, R> = Future<R> Function(IsolateCallback<Q, R> callback, Q message, {String? debugLabel})
Data type of the implementation of the computation function.

Exceptions / Errors

BackpressureDropException
Exception that is thrown when a job is dropped due to backpressure.
DropException
Base exception that is thrown when job is dropped.
InitException
Exception that is thrown if init has not been called before starting to use isolate.
IsolateClosedDropException
Exception that is thrown when a job is dropped due to isolate being closed.
UnexpectedDropException
Exception that preferably should never occur, but that will be thrown when the isolate call was dropped in unexpected cases.