PortCalls class

Sends requests to a port of another isolate and waits for the answers.

The other side gets [replyPort, id, ...message] and answers with [id, value], or [id, null, false] when it failed. A request with no answer after timeout fails with a TimeoutException. One timer checks all waiting requests, so there is no timer per request. The timer only runs while a request waits.

Constructors

PortCalls(Duration timeout)

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeout → Duration
the most time to wait for an answer
final
timerRuns → bool
true while the timer that checks for timeouts runs
no setter
waiting → int
number of requests that wait for an answer
no setter

Methods

close() → void
Closes the reply port. Waiting requests fail.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(SendPort to, List<Object?> message) → Future<Object?>
Sends message to to and gives the answer.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

answer(Object? message, FutureOr<Object?> run(List<Object?> message)) → void
Runs run with the message of a send and answers it. An error is not thrown here (it would stop the serving isolate). The caller gets a StateError with no details, so no data ends up in a log.