bind method

void bind (T impl, InterfaceRequest interfaceRequest)

Implementation

void bind(T impl, InterfaceRequest<dynamic> interfaceRequest) {
  if (!isUnbound) {
    throw FidlStateException("AsyncBinding<${$interfaceName}> isn't unbound");
  }
  if (impl == null) {
    throw FidlError(
        "AsyncBinding<${$interfaceName}> can't bind to a null impl");
  }

  Channel? channel = interfaceRequest.passChannel();
  if (channel == null) {
    throw FidlError(
        "AsyncBinding<${$interfaceName}> can't bind to a null InterfaceRequest channel");
  }

  _impl = impl;
  _reader.bind(channel);

  state = InterfaceState.bound;
}