module library

Protobuf calls over native modules, JavaScript WASM/worker transports, and Dart service implementations. This library has no gRPC dependency.

Classes

ByteCall
CallContext
CallHost
One event-driven executor per instance, with bounded work on each turn.
CallOptions
CancellationToken
Cooperative cancellation, including cancellation before a call is opened.
Codec<T>
Duplex<I, O>
InProcessTransport
Dart services use the same protobuf transport as foreign modules. Register reverse-call services here and supply the transport to the initiating peer's dispatcher. This is an in-process transport, not an exported native ABI.
JsModuleHost
Method
ModuleHost
ModuleInstance
Low-level entries are synchronous and never wait for provider work. Each instance belongs to one Dart isolate; every operation stays serialized there.
NativeModuleHost
Native shared/static libraries cannot be loaded by a browser. Pass a JavaScript WASM or Worker transport to JsModuleHost on the web.
ReadResult
ServiceCall
The provider side of a call. Completion of the registered handler publishes terminal success; throwing RpcError publishes that status and its details. Await send for bounded output capacity and observe context cancellation in external work. requests and recv are alternative ways to consume input.
Transport

Functions

clientStream<I, O>(Transport transport, Method method, Stream<I> requests, Codec<I> input, Codec<O> output, {CallOptions options = const CallOptions()}) → Future<O>
duplex<I, O>(Transport transport, Method method, Codec<I> input, Codec<O> output, {CallOptions options = const CallOptions()}) → Future<Duplex<I, O>>
exportTransport(Object host) → Never
rpcStatus(int code, [Uint8List? details]) → RpcError
serverStream<I, O>(Transport transport, Method method, I request, Codec<I> input, Codec<O> output, {CallOptions options = const CallOptions()}) → Stream<O>
unary<I, O>(Transport transport, Method method, I request, Codec<I> input, Codec<O> output, {CallOptions options = const CallOptions()}) → Future<O>

Typedefs

CallHandler = Future<void> Function(ServiceCall call)

Exceptions / Errors

RequestClosedError
Request input has closed; response bytes and terminal status remain readable.
RpcError