connect static method
Connects to a remote port named portName
.
The corresponding local port should first be created and registered by
the remote app remoteAppId
.
By default a trusted remote port is created. Trusted message ports
restrict communication through them to applications that share a signing
certificate. Set trusted
to false to change this behaviour.
An Exception is thrown if the remote port does not exist.
Implementation
static Future<RemotePort> connect(
String remoteAppId,
String portName, {
bool trusted = true,
}) async {
if (await _manager.checkForRemotePort(remoteAppId, portName, trusted)) {
return RemotePort._(remoteAppId, portName, trusted);
}
throw Exception('Remote port not found');
}