void bind (T impl, InterfaceRequest<T> interfaceRequest)
Binds the given implementation to the given interface request.
Listens for messages on channel underlying the given interface request,
decodes them, and dispatches the decoded messages to impl
.
This object must not already be bound.
The impl
and interfaceRequest
parameters must not be null
. The
channel
property of the given interfaceRequest
must not be null
.
Implementation
void bind(T impl, InterfaceRequest<T> interfaceRequest) {
assert(!isBound);
Channel channel = interfaceRequest.passChannel()!;
_impl = impl;
_reader.bind(channel);
final callback = onBind;
if (callback != null) {
callback();
}
}