sync library
Classes
- BooleanCodec
- BooleanListCodec
- DisconnectedError
-
An error returned from the
recv
function on aLocalClosableReceiver
when the Sender calledclose
. - 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 aLocalClosableReceiver
when the Sender calledsendError
. -
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 aLocalClosableReceiver
. - RecvTimeoutError
-
An error returned from the
recvTimeout
function on aLocalClosableReceiver
. - 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 aLocalClosableReceiver
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 itemT
sent by the Sender will only be seen once by theLocalClosableReceiver
. Even if the Sender callsclose
while theLocalClosableReceiver
s buffer is not empty, theLocalClosableReceiver
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 callsclose
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 atoIsolateCodec
and/or afromIsolateCodec
can be passed to encode and decode the messages.