| |
| |
| |
| # Incoming.fromSvcPath constructor |
| |
| |
| |
| |
| *[<Null safety>](https://dart.dev/null-safety)* |
| |
| |
| |
| Incoming.fromSvcPath() |
| |
| |
| <p>Initializes <a href="../../package-fuchsia_services_services/Incoming-class.md">Incoming</a> with a <code>Directory</code> that is bound to <code>/svc</code> of this |
| component.</p> |
| <p>If you are launching a component use the <a href="../../package-fuchsia_services_services/Incoming/Incoming.md">Incoming()</a> constructor |
| to get an unbound directory.</p> |
| |
| |
| |
| ## Implementation |
| |
| ```dart |
| 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); |
| } |
| ``` |
| |
| |
| |
| |
| |
| |
| |