Mailbox class
Mailbox communication primitive.
This synchronization primitive allows a single producer to send messages to one or more consumers. Producer uses put to place a message into a mailbox which consumers can then take out.
Mailbox object can not be directly sent to other isolates via a
SendPort
, but it can be converted to a Sendable<Mailbox>
via
asSendable
getter.
Mailbox object is owned by an isolate which created them.
Constructors
- Mailbox()
Properties
-
asSendable
→ Sendable<
Mailbox> -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → MailboxState
-
Gets the Mailbox's state which can change concurrently.
Once a Mailbox has reached the MailboxState.closed
state it can no longer change state.
no setter
Methods
-
close(
) → void - Close a mailbox.
-
isClosed(
) → bool -
isEmpty(
) → bool -
isFull(
) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
Uint8List message) → void - Place a message into the mailbox if has space for it.
-
take(
{Duration? timeout}) → Uint8List - Take a message from the mailbox.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited