Channel class

Channel: the client side of one Endpoint.

Constructors

Channel(Transport transport)
Wrap a transport, allocating odd stream ids.
Channel.fromEndpoint(Endpoint endpoint)
Wrap an existing endpoint (bidirectional use; starts its read loop).

Properties

endpoint → Endpoint
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
structCodec → bool
Whether this channel requests the struct codec on every call.
no setter

Methods

bidi(String path, List<Marshaler> reqs, {Map<String, String>? metadata, Duration? timeout}) → Future<ClientStream>
Start a bidi call with all requests sent up front.
clientStreamCall(String path, List<Marshaler> reqs, Unmarshaler resp, {Map<String, String>? metadata, Duration? timeout}) → Future<void>
Send all requests, then decode the one response into resp.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openStream(String path, {Map<String, String>? metadata, Duration? timeout}) → Future<ClientStream>
Open a stream without sending anything: drive it with ClientStream.send / halfClose / recv / cancel.
serverStream(String path, Marshaler req, {Map<String, String>? metadata, Duration? timeout}) → Future<ClientStream>
Start a server-streaming call.
setStructCodec(bool enabled) → void
Make every call on this channel request the struct codec (HEADERS marker dc-codec: struct-v1) and encode requests / decode responses with it. The server must enable it too (see Server.setStructCodec); otherwise calls fail UNIMPLEMENTED. Mirrors the Go Channel.SetStructCodec.
toString() → String
A string representation of this object.
inherited
unary(String path, Marshaler req, Unmarshaler resp, {Map<String, String>? metadata, Duration? timeout}) → Future<void>
Run a unary call, decoding the single response into resp.
withTraceContext(TraceContext? ctx) → Channel
A Channel view sharing this endpoint whose outbound spans are parented to ctx. Explicit call metadata still wins.

Operators

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