| |
| |
| |
| # addServiceForName<T> method |
| |
| |
| |
| |
| *[<Null safety>](https://dart.dev/null-safety)* |
| |
| |
| |
| |
| void addServiceForName |
| <T>(void connector([InterfaceRequest](../../package-fidl_fidl/InterfaceRequest-class.md)<T>), String serviceName) |
| |
| |
| |
| |
| |
| <p>Registers the <code>connector</code> function with the given <code>serviceName</code>. The |
| <code>connector</code> function is invoked when the service provider is asked by |
| the framework to connect to the service in the <a href="../../package-fuchsia_services_services/ServiceProviderImpl/connectToService.md">connectToService</a> method.</p> |
| |
| |
| |
| ## Implementation |
| |
| ```dart |
| void addServiceForName<T>( |
| void Function(InterfaceRequest<T>) connector, String serviceName) { |
| _connectorThunks[serviceName] = (Channel? channel) { |
| connector(InterfaceRequest<T>(channel)); |
| }; |
| } |
| ``` |
| |
| |
| |
| |
| |
| |
| |