Google is committed to advancing racial equity for Black communities. See how.

Incoming.fromSvcPath constructor

*<Null safety>*

Incoming.fromSvcPath()

Initializes Incoming with a Directory that is bound to /svc of this component.

If you are launching a component use the Incoming() constructor to get an unbound directory.

Implementation

factory Incoming.fromSvcPath() {
  if (!io.Directory(_serviceRootPath).existsSync()) {
    final componentName = io.Platform.script.pathSegments
        .lastWhere((_) => true, orElse: () => '???');
    throw Exception(
        'Attempting to connect to the /svc directory for [$componentName] failed. '
        'This is an indication that the system is not in a valid state.');
  }
  final channel = Channel.fromFile(_serviceRootPath);
  final directory = DirectoryProxy()
    ..ctrl.bind(InterfaceHandle<Directory>(channel));
  return Incoming.withDirectory(directory);
}