Google celebrates Hispanic Heritage Month. See how.

connectToServiceByNameWithChannel method

*[<Null safety>](*

void connectToServiceByNameWithChannel (String? serviceName, Channel? channel)

Connects to the incoming service specified by serviceName through the channel endpoint supplied by the caller.

If the service provider is not willing or able to provide the requested service, it should close the channel.

If this object is not bound via the request method before this method is called an IncomingStateException will be thrown.


void connectToServiceByNameWithChannel(
    String? serviceName, Channel? channel) {
  if (serviceName == null) {
    throw Exception(
        'serviceName must not be null. Check the FIDL file for a missing '
  if (channel == null) {
    throw ArgumentError.notNull('channel');

  if (_dirProxy.ctrl.isUnbound) {
    throw IncomingStateException(
        'The directory must be bound before trying to connect to a service. '
        'See [Incoming.request] for more information');

  // connection flags for service: can read & write from target object.
  final OpenFlags _openFlags =
      OpenFlags.rightReadable | OpenFlags.rightWritable;
  // 0755
  const int _openMode = 0x1ED;
      _openFlags, _openMode, serviceName, InterfaceRequest<Node>(channel));