*[<Null safety>](https://dart.dev/null-safety)*
void connectToService <T>(AsyncProxy<T>? serviceProxy, {String? name})
void connectToService<T>(AsyncProxy<T>? serviceProxy, {String? name}) { if (serviceProxy == null) { throw ArgumentError.notNull('serviceProxy'); } final String? serviceName = name ?? serviceProxy.ctrl.$serviceName; if (serviceName == null) { throw Exception( "${serviceProxy.ctrl.$interfaceName}'s controller.\$serviceName must " 'not be null. Check the FIDL file for a missing [Discoverable]'); } // Creates an interface request and binds one of the channels. Binding this // channel prior to connecting to the agent allows the developer to make // proxy calls without awaiting for the connection to actually establish. final serviceProxyRequest = serviceProxy.ctrl.request(); connectToServiceByNameWithChannel( serviceName, serviceProxyRequest.passChannel()); }