sync library

Classes

BooleanCodec
BooleanListCodec
DisconnectedError
An error returned from the recv function on a LocalClosableReceiver when the Sender called close.
DoubleCodec
DoubleListCodec
IntCodec
IntListCodec
IsolateReceiver<T>
IsolateSender<T>
ListSizedTCodec<T>
LocalReceiver<T>
Receiver for a single isolate.
LocalSender<T>
Sender for a single isolate.
Mutex
Mutual exclusion.
OtherError
An error returned from the recv function on a LocalClosableReceiver when the Sender called sendError.
Receiver<T>
The receiving-half of channel. Receivers do not close if the Sender sends an error.
ReceiverImpl<T>
RecvError
An error returned from the recv function on a LocalClosableReceiver.
RecvTimeoutError
An error returned from the recvTimeout function on a LocalClosableReceiver.
RwLock
Mutual exclusion that supports read and write locks.
SendCodec<T>
The codec use to encode and decode data send over over a channel between isolates.
Sender<T>
The sending-half of channel.
SendError
A SendError can only happen if the channel is disconnected, implying that the data could never be received.
StringCodec
TimeoutError
An error returned from the recvTimeout function on a LocalClosableReceiver when the time limit is reached before the Sender sends any data.

Functions

channel<T>() → (LocalSender<T>, LocalReceiver<T>)
Creates a new channel, returning the Sender and LocalClosableReceiver. Each item T sent by the Sender will only be seen once by the LocalClosableReceiver. Even if the Sender calls close while the LocalClosableReceivers buffer is not empty, the LocalClosableReceiver will still yield the remaining items in the buffer until empty.
isolateChannel<T, U>(FutureOr<void> func(IsolateSender<U> tx, IsolateReceiver<T> rx), {SendCodec<T>? toIsolateCodec, SendCodec<U>? fromIsolateCodec}) Future<(IsolateSender<T>, IsolateReceiver<U>)>
isolateChannel is used for bi-directional isolate communication. The returned Sender and Receiver can communicate with the spawned isolate and the spawned isolate is passed a Sender and Receiver to communicate with the original isolate. Each item T sent by a Sender will only be seen once by the corresponding Receiver. If the Sender calls close while the Receiver's buffer is not empty, the Receiver will still yield the remaining items in the buffer until empty. Types that can be sent over a SendPort, as defined here https://api.flutter.dev/flutter/dart-isolate/SendPort/send.html , are allow to be sent between isolates. Otherwise a toIsolateCodec and/or a fromIsolateCodec can be passed to encode and decode the messages.