NitroCoalescer class

Demultiplexer for coalesced @nitroNativeAsync completions.

Opt-in batching for the case where many native-async calls are in-flight and finish together: the native side posts one kArray of [callId0, value0, …] over a single shared port instead of one post per call, so the whole burst shares one isolate wake. This class owns that port and resolves each pending call by its id. Scalar (int) results only.

The per-call ReceivePort path (openNativeAsync) stays the default — it is right for a single call. See issue #39.

Constructors

NitroCoalescer()

Properties

hashCode → int
The hash code for this object.
no setterinherited
nativePort → int
The native port id to hand to the native submit call so its coalescer can address this demuxer.
no setter
pendingCount → int
Number of calls still awaiting a result.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sendPort → SendPort
The SendPort the native coalescer posts batches to. Most callers only need nativePort; exposed for advanced use and testing (inject a batch [callId0, value0, …] directly).
no setter

Methods

dispose({int drainTurns = 8}) → Future<void>
Closes the shared port and settles every pending call.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
submit(void call(int callId, int nativePort)) → Future<int>
Registers a pending call, invokes call with the freshly-assigned id and nativePort (which the native submit forwards to its coalescer), and returns the future that completes when the batch carrying this id arrives. Throws a StateError if called after dispose — the port is closed, so the result could never arrive and the future would hang forever.
toString() → String
A string representation of this object.
inherited

Operators

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