setAutoSwitchBestConnection method
Enables or disables automatic switching to the best XMR connection.
This method sends a SetAutoSwitchRequest to configure whether the best XMR connection should be automatically selected.
Example:
await xmrConnectionsClient.setAutoSwitchBestConnection(true);
print('Auto-switch enabled.');
Returns:
- A
Future
containingtrue
if the setting is successfully updated. null
if an error occurs.
Implementation
Future<bool?> setAutoSwitchBestConnection(bool autoSwitch) async {
if (!havenoChannel.isConnected) {
throw DaemonNotConnectedException();
}
try {
await havenoChannel.xmrConnectionsClient!
.setAutoSwitch(SetAutoSwitchRequest(autoSwitch: autoSwitch));
return true;
} on GrpcError catch (e) {
handleGrpcError(e);
}
return null;
}