*<Null safety>*
void connectToService <T>(AsyncProxy<T>? serviceProxy)
Connects to the incoming service specified by serviceProxy
.
If this object is not bound via the request method before this method is called an IncomingStateException will be thrown.
Implementation
void connectToService<T>(AsyncProxy<T>? serviceProxy) {
if (serviceProxy == null) {
throw ArgumentError.notNull('serviceProxy');
}
final String? serviceName = 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());
}