blob: e0bb6a23088b675a1d5d8de3206056a05ba7cafe [file] [log] [blame] [view]
# addServiceForName<T> method
*[<Null safety>](https://dart.dev/null-safety)*
void addServiceForName
&lt;T>(void connector([InterfaceRequest](../../package-fidl_fidl/InterfaceRequest-class.md)&lt;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));
};
}
```